Re: Issues with select
Re: Issues with select
- Subject: Re: Issues with select
- From: Quinn <email@hidden>
- Date: Fri, 30 Apr 2004 00:46:50 +0100
At 16:25 -0500 29/4/04, Aaron Ballman wrote:
So, am I just misunderstanding something here, or is this a bug that
I stumbled across?
It's one of those great BSD sockets API design 'features'. For
non-blocking connects, select makes the socket writable when the
connection attempt is done. You then have to do something else to
see whether it was successful. The standard trick is to call
getpeername.
My SocketCancel sample code shows how to do this (based on code from Stevens).
<
http://developer.apple.com/samplecode/SocketCancel/SocketCancel.html>
This is standard BSD sockets behaviour. Don't ask me why or I'll
start to whimper.
More details in "UNIX Network Programming" 2nd ed (Stevens) Section 15.3 p410.
Curiously, I've heard tell that at least some versions of Windows do
this correctly. That is, you can an error flag from select when the
connection fails. Be careful of this if you're writing cross
platform sockets code.
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.