2

The netstat output with the tomcat process(pid: 28899) is as followed:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:8009            0.0.0.0:*               LISTEN      28899/java      
....
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      28899/java        
....
tcp        0      0 127.0.0.1:8005          0.0.0.0:*               LISTEN      28899/java 

So why can one process listen on three tcp ports? Is it because that 8009 and 8005 are listened by two child-processes of tomcat and netstat only display the parent process ID?

1
  • What makes you think there's a limit to the number of sockets/ports a single process can open and listen to?
    – growse
    Nov 6, 2012 at 21:05

2 Answers 2

1

The short answer is "because the process asked the kernel to let it bind to three ports". There's no implicit bar on this; here's my apache, merrily listening to two ports:

[madhatta@lory mail]$ sudo netstat -apn|grep http
tcp        0      0 178.18.123.145:443          0.0.0.0:*                   LISTEN      1753/httpd          
tcp        0      0 :::80                       :::*                        LISTEN      1753/httpd          
1

More specifically, 8009 is the default AJP connector port for Tomcat (for, say, mod_ajp in Apache to communicate with Tomcat) and localhost:8005 is the default shutdown port. Presumably, you're using 8000 as the HTTP connector port. You should be able to find a more in depth discussion in the Tomcat documentation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .