0

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?

twimo
  • 4,061
  • 5
  • 29
  • 32

1 Answers1

2

Tomcat listens on several ports. 8005 is the shutdown port, and 8009 is the connector port for servicing requests from an Apache server.

In general, a process can listen on as many ports as it wants, just by opening multiple server sockets. Internally it's highly likely that each port will be handled by its own thread, but even that is not necessary with select() service calls and asynchronous I/O.

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190