linux - How can you have a TCP connection back to the same port? -


machine rhel 5.3 (kernel 2.6.18).

some times notice in netstat application has connection, established tcp connection when local address , foreign address same.

here same problem reported else too.

the symptoms same described in link - client connects port x port of server running locally. after time netstat shows client has connection 127.0.0.1:x 127.0.0.1:x

how it's possible?

edit 01

simultaneous open causing problem (thanks lot hasturkun). can see on classical tcp state diagram in transition syn_sent state sync_received

this may caused tcp simultaneous connect (mentioned on post lkml, see here).

it's possible program looping on trying connect port within dynamic local port range (which can seen in /proc/sys/net/ipv4/ip_local_port_range),to succeed while server not listening on port.

on large enough number of attempts, socket being used connect may bound same port being connected to, succeeds due mentioned simultaneous connect. magically have client connected itself


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -