Can two applications listen to the same port?

前端 未结 17 1081
天涯浪人
天涯浪人 2020-11-22 03:50

Can two applications on the same machine bind to the same port and IP address? Taking it a step further, can one app listen to requests coming from a certain IP and the othe

17条回答
  •  迷失自我
    2020-11-22 04:30

    Just to share what @jnewton mentioned. I started an nginx and an embedded tomcat process on my mac. I can see both process runninng at 8080.

    LT-MAC:~ b0$ sudo netstat -anp tcp | grep LISTEN
    tcp46      0      0  *.8080                 *.*                    LISTEN     
    tcp4       0      0  *.8080                 *.*                    LISTEN   
    

提交回复
热议问题