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.


Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Emmanuel Jannetti blog

Search

Archives
« avril 2014
lun.mar.mer.jeu.ven.sam.dim.
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today