For some reason whenever bind (or any other Winsock function) returns an error, errno is still set to 0. Any ideas as to what might be causing this?
Printable View
For some reason whenever bind (or any other Winsock function) returns an error, errno is still set to 0. Any ideas as to what might be causing this?
Use WSAGetLastError() to get the last error for winsocks.
No idea. I usually get my error codes, but sometimes they disappear. Usually it's because I've screwed up somewhere else though :) A more specific explanation from someone would be nice though.
**EDIT** Well, yes use WSAGetLastError if you're using Winsock, but those sometimes disappear on me too.
Well for winsocks WSAGetLastError() only work on commands like accept, bind, listen, etc. If using WSAAsyncSelect the error message is stored in the HIWORD of lparam.
Not true... recv() at least should generate errors retreivable by WSAGetLastError(). When a remote socket drops, recv() will return SOCKET_ERROR and set the error to WSAECONNRESET. I'm pretty sure the other functions have similar function; I highly doubt MS would make a function like WSAGetLastError() only for the least-used socket functions (i.e. connecting/binding/etc.).Quote:
Well for winsocks WSAGetLastError() only work on commands like accept, bind, listen, etc. If using WSAAsyncSelect the error message is stored in the HIWORD of lparam.
did you not see the ETC?!?!?!
Sorry, brain isn't working today.
[whine]
Went for road test for a drivers license and got a real jerk who was exceedingly rude and failed me on the basis of being too hesitant (i.e. not aggressive enough) and then wouldn't let my sister talk to the manager on the phone when she called to lodge a complaint, and mouthed off at her too. I think he was an abused child or something.
[/whine]
Since those 3 you put pretty much included everything except for recv() and send() and you said "only works for" I figured you meant to exclude those two :rolleyes: My bad.