[Eventmachine-talk] Ruby I/O

Roland Cozzolino
Tue, 13 Mar 2007 21:04:25 -0000

In winsock, getpeername will return a SOCKET_ERROR when it fails but it
supposed to be called on a connected socket only (you can of course get the
error through the WSAGetLastError). The issue is when the socket is not
connected and you call getpeername anyway.  I this is the case, it may NOT
return SOCKET_ERROR, since it''s the wacky windows kernel, but I am
certain
it will return something other than 0, which is bad.



From: eventmachine-talk-bounces at rubyforge.org
[mailto:eventmachine-talk-bounces at rubyforge.org] On Behalf Of Francis
Cianfrocca
Sent: Tuesday, March 13, 2007 8:16 PM
To: eventmachine-talk at rubyforge.org
Subject: Re: [Eventmachine-talk] Ruby I/O



On 3/13/07, Thomas Ptacek <tqbf at matasano.com> wrote:

BTW, I don''t know if the comment in ed.cpp:463 (0.7.0) is still
germane, but I thought getpeername() did the sane thing in winsock,
returning error on unconnected sockets that select writeable.



so you think a getpeername call would return a recognizable error on
Windows? The real problem with that code path is that I don''t think
Windows
reliably selects a socket as selectable when it has a connect error, so
there''s no opportunity to call getpeername or anything else. (This is
only
germane to the case in which you''re initiating a TCP connection to a
remote
peer.) Perhaps the socket selects in an error state on Windows? I never
tried that because it''s so unlike all the Unix flavors.



-------------- next part --------------
An HTML attachment was scrubbed...