2010-09-22

Port Number Problems

Someone complains: "Port 8080 is FUBAR for some reason..."

What do you do? Here's a few things to try.



Sanity Check

Try another computer, another OS, another human, another Ethernet cable, etc., as a sanity check.



Point Your Web Browser

Check that no other app is listening on the port in question. Without running the system you are trying to reach, point your web browser to the port in question, such as:

http://www.Example.com:8080/

If the target app is running on your own computer, use the "localhost" IP number that always means "here on this computer locally": 127.0.0.1


After a pause, the web browser should report an error saying it could not connect. If it does seem to connect, you may have an app already listening on that port.



Port Scan

On a Mac, another way to check for other apps using that port is running the app:
Applications > Utilities > Network Utility > Port Scan

Chere are over 64,000 ports, so you may want to narrow the range to go faster. If a port is in use, it is listed. Not being listed means the port is free at the moment.



Firewalls

Check your firewall(s).

Mac OS X 10.5 & 10.6 have two firewalls in place, acting in parallel. 

• One firewall tracks which applications have permission to receive incoming network connections. This tool is turned off and on in System Preferences in later versions of Mac OS X. 

• The other firewall inspects network packets as they flow in and out of your computer. Any number of rules can be created to allow, deny, or modify those packets. 

In earlier versions of Mac OS X, you controlled this firewall in System Preferences, but in later versions this firewall is invisible. Use the command line tool 'ipfw' or download the GUI wrapper around ipfw, an app called "WaterRoof". 

Read my blog post for more info about 'ipfw'. 



Reboot

If all else fails, reboot your computer, cold. Seriously.



Sniff Packets

Use the "tcpdump" command line tool in Mac OS X (and other Unix-based systems) to look at your network packets. Apple tells you how. Use WireShark or other such GUI tools to do the same. Not in my skill set, but perhaps in yours or a colleague’s.


No comments:

Post a Comment