As a result of this patch (which is currently applied in cvs head):
http://www.winehq.com/hypermail/wine-patches/2002/12/0009.html
WS_bind() currently does this before every call to bind():
WS_setsockopt( s, WS_SOL_SOCKET, WS_SO_REUSEADDR, (char*)&on, sizeof(on) );
Basically, it sets SO_REUSEADDR for every call to WS_bind().
I can't imagine this is the correct thing to do. According to MSDN, bind() should fail unless the program has explicitly set SO_REUSEADDR.
See Error code WSAEADDRINUSE at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/win...
I found that this patch causes major problems with the xten sipphone client. The xten client does not explicitly set SO_REUSEADDR and depends on bind() failing if it tries to bind to the same local address/port twice.
When the sipphone client needs a socket, it starts at port 8000, and calls bind() on successive ports until bind() returns success. So normally, if the program is already using port 8000, then bind() will fail and will try port 8001. However, with the above patch in place, bind() always works. So then the sipphone client will be using port 8000 twice, which the program is not designed to handle.
If I remove the call to WS_setsockopt(), the xten sipphone client works correctly.
I am proposing that the portion of the patch applied to WS_bind() be removed unless someone has a convincing arguement that the patch is actually valid.
Jeremy Shaw.
Jeremy Shaw wrote:
As a result of this patch (which is currently applied in cvs head):
http://www.winehq.com/hypermail/wine-patches/2002/12/0009.html
This also makes the Quicktime player unable to view streaming video, although I have to confess I do not know why, except that the bind failure seems to make the player take a slightly different path.
With this change, we can use the 6.3 version of Quicktime to see streamed video from Wineconf...
In the hopes it'll get noticed, here's a patch to remove it:
Changelog: Jeremy Shaw jeremy.shaw@lindows.com Remove forced WS_SO_REUSEADDR on all binds
Index: dlls/winsock/socket.c =================================================================== RCS file: /home/wine/wine/dlls/winsock/socket.c,v retrieving revision 1.144 diff -u -r1.144 socket.c --- dlls/winsock/socket.c 2 Jan 2004 20:12:00 -0000 1.144 +++ dlls/winsock/socket.c 10 Jan 2004 22:56:57 -0000 @@ -1302,10 +1302,6 @@ else { int on = 1; - /* The game GrandPrixLegends binds more than one time, but does - * not do a SO_REUSEADDR - Stevens says this is ok */ - TRACE( "Setting WS_SO_REUSEADDR on socket before we bind it\n"); - WS_setsockopt( s, WS_SOL_SOCKET, WS_SO_REUSEADDR, (char*)&on, sizeof(on) );
if (bind(fd, uaddr, uaddrlen) < 0) {