jumping sockets
One day I've faced an X-files situation on windows.
(now you should hear the sound
tudu..dudu..duduuuu from the trailer,... no ?
...never mind :-)).
One server was listening to connections on a specific address and port. so far
so good...
Another instance of that server was launched (bound on the address/port by
mistake) and I suddenly
saw a client communication already started with the first server ending with
the second one.
As you can imagine : At First I was afraid,..I was petrified...
I scratched my head for days .... (unless you are already bold... don't try
:-)).
reading Microsoft
documentation
for the 23343123 times I found the solution. the
reuse address
of windows socket (winsock) has a tiny difference which make a big one in
the end. binding a socket
on an address already used is allowed. Not only when the socket just exists like
on Unix but at any time.
The second server was stealing the socket on the first.
I am still confused about some details and there are surely some parts which I
didn't get
but what I am sure of is that removing the flag SO_REUSEADDR solved my issue.
Posted at
06:51PM août 09, 2007
by ejannett in Windows |