Page 1 of 1

strange sockets behavior

PostPosted: Feb 25, 2007 @ 2:44pm
by jaguard
Has anyone tried doing client-server stuff on the pocketpc? I found something looking like a bug, and it took me a vast amount of time to locate the source.
I'm operating on non-blocking sockets, unsing tcp/ip streaming operation. I didn't bother if there's a data to recieve, since non-blocking sockets should return in any case, returning error explaining me what's going wrong.
This didn't work. When I call recv(), it never returns if there is no data, or if I request more than it can recieve. This is wrong. There is a plain statement about non-blocking sockets in msdn:

WSAEWOULDBLOCK
10035
Resource temporarily unavailable.
This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. It is a nonfatal error, and the operation should be retried later. It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established.


So it should return immidiately -1, and the get last error should return 10035 absolutely. This is what happens on a PC, but on a PocketPC recv hangs, and I had to reset my PDA. Though I can close connection on the other device, only then recv returns.

It took me 3 days banging my head into the wall to fix the stuff by calling ioctlsocket before(though I had to rewrite a lot of stuff until I discovered what actually must be done).

Can anyone comment, why is this happenning on a PocketPC?

PostPosted: Feb 25, 2007 @ 7:33pm
by Dan East

PostPosted: Feb 26, 2007 @ 5:40pm
by jaguard

PostPosted: Feb 26, 2007 @ 11:11pm
by fast_rx

PostPosted: Feb 27, 2007 @ 10:45am
by jaguard