I'm trying to track down an issue I have with windows sockets.
I have an client and server which I use to send simple text commands data back and forth.
I have a non-blocking socket which I use to send data from my client to the server
int err = send( socket, stringToSend.c_str(), stringToSend.size(), 0 );
I then use the following to check if there is any data on the socket to read:
if (SOCKET_ERROR != ioctlsocket( socket, FIONREAD, (DWORD*)&nLength ))
if (0 < nLength)
err = recv( socket, buf, nLength, 0 );
Now I have a strange problem.
1. When I send the first piece of data from client to server I am able to receive a response from the server.
2. Then I try to send the smae piece of data again, but this time ioctlsocket
always reports that no 0 bytes are available to read from the socket (nLength is always 0).
The strange thing is that if I use wireshark I can see that the server has actually sent data to the client.
What would cause ioctlsocket to report that nLength = 0 whenever I can see data sent via wireshark