Socket module does not work in my Python
Very simple. >>> import socket >>> socket.gethostbyname('http://yahoo.com') Traceback (most recent call last): File "<stdin>", line 1, in <module> socket.gaierror: [Errno -2] Name or service not known ...
Very simple. >>> import socket >>> socket.gethostbyname('http://yahoo.com') Traceback (most recent call last): File "<stdin>", line 1, in <module> socket.gaierror: [Errno -2] Name or service not known ...
I'm attempting to get started with MINA, and all of the examples seem to have data written to the session, rather than making use of a method that can write the same type of data over and over. I'm trying to make use of org.apache.mina.filter.codec.demux.MessageEncoder / MessageDecoder to encode / decode messages, which will allow me to...
Hi to all, I'm programming a very simple socket server following this sample code. The server is up and running and I can connect to it via telnet (using Putty, actually). Whenever a new connection is received, I spawn a new thread that is the following code: DWORD WINAPI receive_cmds(LPVOID lpParam) { char outbuffer[100]; ...
hello, i'm working with java.nio.channels.Selector and i'd like to create a separate thread for each selectedKey that is ready for read/write/accept but i want to make sure that the same socket is never handled by two different threads simultaneously. what would be the best way to do it ? i was thinking to cancel each selectedKey before...
What's the most appropriate way to detect if a socket has been dropped or not? Or whether a packet did actually get sent? I have a library for sending Apple Push Notifications to iPhones through the Apple gatways (available on GitHub). Clients need to open a socket and send a binary representation of each message; but unfortunately Ap...
I am testing out a Socket Server application in c and I am getting an error on the bind function with code 10038. I looked this up and MSDN says it means: An operation was attempted on something that is not a socket. Either the socket handle parameter did not reference a valid socket, or for select, a member of an fd_set was not valid....
Hi I have the following program to check the send buffer size for a UDP socket. However, I the return value is a bit confusing to me. I use the following simple app: #include <sys/socket.h> #include <stdio.h> int main(int argc, char **argv) { int sockfd, sendbuff; socklen_t optlen; sockfd = socket(AF_INET, SOCK_DGRAM, 0); if(sockf...
i am new to programming and i am confused about asynchronous socket programming. for example lets say i have 2 BeginSend, one right after another. the first sends a million chars and the secnd sends only 64 chars. due to the asynchronous nature won't the second BeginSend complete before the first one? if so how can i tell the recieve...
Hi all. Let me explain a bit the app i'm doing. I'm creating a central UDP (needs to be UDP) server for multiple and concurrent clients that also "talk" between them. I do a check into a dict of known clients addresses and create a client handler thread if "i dont know" the client. Else, the thread receives the data ad does its job. Th...
I'm writing a multiplayer game (obviously using UDP sockets. note: using winsock 2.2). The server code reads something like this: while(run) { select(0, &readSockets, NULL, NULL, &t) if(FD_ISSET(serverSocket, &readSockets)) { printf("%s\n","Data receieved"); //recvfrom over here } FD_SET(serverSocket,...
I have a very simple server/client performance test using boost::asio on Windows and it seems to be performing really poorly. I'm hoping that I'm just using the library incorrectly and would appreciate any advice. I have a session class that writes a message-length and then writes a message, and then waits to read a message-length and ...
hi I am facing a problem with socket and I would be glad if you could help ... The problem is that when I send data more than once it blocks, e.g: //--- client --- //.. send(sock, buf_1, sizeof(buf_1), 0); for (x10){ //... send(sock, buf_2, sizeof(buf_2), 0); if (recv(sock, buf_2, sizeof(buf_2), 0)<0) printf("recv_2() fai...
Hi everyone, I've been working with the "new" (3.5, I think?) asynchronous socket API and have a question or two about it that I can't find answers to. All of the *Async methods return a bool, which is false if the operation completed synchronously. I'm a little confused as to how/why this could happen. It's not always an error conditi...
We are trying to get two programs to communicate with each other in a game-like fashion. They maintain a TCP connection with a central server for "control" type information, which that central server ensures both clients receive. The two clients then communicate with a udp server using sendto() and recvfrom() which just sends the infor...
What is the difference between an ordinary socket and a TCP socket?. Also in a web server like IIS, how many TCP sockets can be created in a server?. I had read somewhere that when the client connects to a web server(on port 80), the web server creates a temporary port and replies to the client on the temporary port. Is that true ?. ...
I have built a Python server to which various clients can connect, and I need to set a predefined series of messages from clients to the server - For example the client passes in a name to the server when it first connects. I was wondering what the best way to approach this is? How should I build a simple protocol for their communicati...
Is it possible to detach a native socket from Boost.ASIO's socket class? If so, how can it be done? I can't seem to find anything obvious in the documentation. As a quick overview of what I'm trying to accomplish: I have a class that makes a connection and does some negotiation using Boost.ASIO, then passes back a native Windows SOCKET ...
i am studying asynchronous C# Sockets at the moment and i have noticed something that i am confused about. in all the End...(Accept/Connect) etc there is a code section like: Socket s = (Socket) ar.AsyncState; here it is being casted as a socket. as each End uses these local Sockets is there any point in trying to close() any of the...
We have a Win32 based app that uses Bonjour to advertise itself, but plain ol sockets to actually communicate. On a regular XP, Vista, or 7 system using the Windows firewall service we have no issues. We have our installer set to allow ourselves through the firewall. But if a user installs McAfee as an example, even if they click to all...
In using Apache MINA, I'm sending a login request from the client, which is interpreted on the server via LoginRequestDecoder (implements org.apache.mina.filter.codec.demux.MessageDecoder). I now want to send a response (LoginResponse) that includes a success/failure code. Should I be sending the response from the LoginRequestDecoder's...