How could two processes bind onto the same port?

Posted by Matt Ball on Server Fault See other posts from Server Fault or by Matt Ball
Published on 2013-11-07T02:43:04Z Indexed on 2013/11/07 3:58 UTC
Read the original article Hit count: 525

Filed under:
|

I just ran into an issue where a request made to localhost:8080 from curl was hitting a different server than the same request made from inside Node. lsof -i :8080 revealed that two processes were both binding onto the same port:

COMMAND   PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
node    51961 mball   14u  IPv4 0xd980e0df7f175e13      0t0  TCP *:http-alt (LISTEN)
java    62704 mball  320u  IPv6 0xd980e0df7fe08643      0t0  TCP *:http-alt (LISTEN)

How is this possible? Were they binding onto different interfaces? Or was it the IPv4 vs 6?

If you're curious, node was hitting the other node process, curl was hitting the java process. The java process was started after the node process.

© Server Fault or respective owner

Related posts about networking

Related posts about macosx