A Funny Java Flavoured Look at the World

Wednesday, August 30, 2006

Finding out what ports are being used on your machine

I have been having some troubles trying to deploy two tomcats on my machine. I had one on port 8080 and the other on port 8181.

Although I changed the port used to show the web stuff I hadn't changed the port used to shutdown Tomcat and this meant I had problems because Tomcat usually listens out on port 8005 for instructions to shutdown the Tomcat server. Tomcat does also have something listening on port 8009 which is something to do with a Tomcat Adapter, which brings some horrible memories about setting up a redirect on ISS so that Tomcat could listen on port 80.

it all seemed to work fine once I had changed the shutdown port from 8005 to 8007 on one of my instances of Tomcat.

When I was thinking about setting the shutdown listener to another port I wondered what ports on my machine were being used. I found that you can find what ports are being used on your machine in either a terminal window on Linux or a DOS window on windows using the netstat command. There are a number of options but I found that

netstat -a

returned the details of the ports being used and it is slightly interesting reading for about 10 seconds.

I was reading about ports today from this manual and below is the quote

Use the default ports if they are not already in use. Otherwise, use a base number between 2048 and 65535 that is not being used. Because numbers between 1024 and 2048 are commonly used for standard system ports, Red Brick Warehouse installation and configuration utilities do not accept values below 2048. Use a number above 4098 to minimize the chance of conflict.
I am now happily running two tomcats and before you ask its for testing purposes. It also has the advantage of giving me another Tomcat to clutter up. Talking of Tomcat does anyone know why they no longer include the admin user by default, I imagine it's for security reasons with probably 90 percent of people not changing the default password. It's quite annoying having to add the user in yourself though

1 Comments:

  • Sometimes it it very useful to know who uses this port, in order to shut him down. :)

    netstat -o + Ctrl-Shift-ESC will help to do it.

    By Anonymous Anonymous, at Fri Sept 08, 12:30:00 pm 2006  

Post a Comment

<< Home