[Bug 9425] Select behavior different on Wine
wine-bugs at winehq.org
wine-bugs at winehq.org
Sun Feb 5 12:36:28 CST 2012
http://bugs.winehq.org/show_bug.cgi?id=9425
--- Comment #16 from Ruediger Meier <sweet_f_a at gmx.de> 2012-02-05 12:36:28 CST ---
(In reply to comment #15)
> (In reply to comment #10)
> > Wine's select will return immediately with 0 which should only be returned
> > after really timeouting!
> >
> > Window's would return 0 after the specified timeout.
>
> Are you sure about this? If you try to connect to a closed port (in a host
> without firewall) the socket will receive the RST flag and windows will return
> as immediately as other systems.
No, in opposite to other systems windows would only return immediately if I
also
select the "exceptfds" (which I'm doing in my test code but not in comment
#10).
But even these other systems would not return value 0 (=timeout) but 1 because
they
set writefds even if connection is broken.
> And if you try to connect to a non-existent
> host (or the port is closed and the host has a firewall) the connection attempt
> will return after the configured timeout value.
Yes, this works as expected on wine.
Here a bit pseudo code how it should work comparing Linux and windows
on Linux:
connect() // non blocking
ret = selcet( ..., writefds, ... )
if (ret < 0) -> strange error
if (ret == 0) -> timeout
if (ret > 0) -> writefds is set, connection process finished,
now we need to ask getsockopt if it was successful or not
on Windows:
connect() // non blocking
ret = selcet( ..., writefds, exceptfds, ... )
if (ret < 0) -> strange error
if (ret == 0) -> timeout
if (ret > 0) -> if writefds is set -> connection succesful
if exceptfds is set (*) -> connect failed
(we may ask getsockopt why)
So case (*) (the one that differs between win32 and linux) is the one that is
broken in wine. Sometimes select returns 0 instead of >0 and setting exceptfds.
And getsockopt seems to never tell us about any errors.
> Thanks for the testing code, I'll try it as soon as I have time.
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the wine-bugs
mailing list