Can two applications listen to the same port? (Stackoverflow)
kitt
posted @ 2013年10月29日 11:22
in 技术类 Tech
, 1247 阅读
For TCP, no. You can only have one application listening on a single port at one time.
Now if you had 2 network cards, you could have one application listen on the first IP and the second one on the second IP using the same port number.
For UDP (Multicasts), multiple applications can subscribe to the same port.
2013年10月29日 22:25
For Linux and TCP, yes. Child processes can inherit that socket (see how Nginx does with its workers). You can also pass sockets around.
2013年11月01日 22:31
I don't know that. Thanks!@依云: