Original Post
Hmm... I'm feeling a bit stupid for asking this, but after searching this forum, the MSDN WinSock reference and google for a while now I give up. In every text I've read on sockets, non-blocking sockets are mentioned. What's not mentioned is how to make a socket non-blocking. How is this done? I've created a socket like so: SOCKET s = socket(AF_INET, SOCK_DGRAM, 0); And then I receive data like this: sockaddr_in saServer; saServer.sin_family = AF_INET; saServer.sin_addr.s_addr = htonl(INADDR_ANY); saServer.sin_port = htons(27017); bind(s, (sockaddr*) &saServer, sizeof(saServer)); sockaddr_in saClient; int clientSize = sizeof(saClient); char buf[1024]; memset(buf, 0, sizeof(buf)); recvfrom(s, buf, sizeof(buf), 0, (sockaddr*) &saClient, &clientSize); I read that the last parameter is optional but the communication doesn't work at all when I replace it with 0.