Closed luiscuriel closed 11 years ago
Everything I can find in the windows documentation says that -1 should be returned on error. Can you find any documentation on this returning zero instead?
It definitely seems weird that there would be ready data but recv() would return 0.
Hi Jack,
from the code:
int sock_read(const sock_t sock, void * const buff, const size_t len) { return recv(sock, buff, len, 0); }
Recv on msdn:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms740121(v=vs.85).aspx
It says:
If the connection has been gracefully closed, the return value is zero.
So the problem is that it was not being detected when the connection was closed by the server, for example restarting our xmpp server (ejabberd), and the libstrophe client remained connected all the time.
Let me know if you need more info.
Best Regards, Luis.
On windows, sock_read returns 0 when an error reading occurs.