How to Find My Port Number on My LAN

Port numbers are assigned to applications and their communications on a local area network (LAN). They help to keep one particular "conversation" distinguishable from another. Default port numbers have been assigned to most applications or services. For example, standard web access (http) runs over port 80, and secure web access (https) runs over port 443. Official well-known port numbers can be found at the Internet Assigned Numbers Authority's website, which is linked in the Resources section. Many commonly known unofficial port numbers are in use by vendors as well.

...
Communication takes place over a LAN.

Step

Open a terminal. For Windows, open a command prompt by clicking on "Start" and typing "CMD" in the "Run" box. For a Mac, type "terminal" in the finder, or go to the Applications folder, open the Utilities folder and open "Terminal." These commands can be run from the client computer or from the server side. Oftentimes, you will not have access to the server side.

Step

Run the command "netstat -an" from the terminal or command prompt. The output is similar for Linux, Windows and Mac. If your output has multiple sections, then scroll up until you find these column headings: Protocol, Local address, Foreign Address and State. The local and foreign address columns indicate the Internet protocol (IP) address and the port number, separated by a colon. Each row indicates an application that is either in a conversation with another computer or waiting to establish a conversation.

Step

Look for a state of "listen" to find the port number of services running on your computer (your computer acting as a server.) "Listen" means your computer is waiting for another computer to request access to that application. Look under the "Local address" column of the associated row to determine the port number.

Step

Look for the state of "established" to find the port number your computer uses to connect to services running on another computer (your computer acting as a client). "Established" means your computer is communicating with an application on another computer. Look under the "Foreign Address" column of the associated row to determine the port number.

Step

Run "netstat -bn" and "netstat -abn" from a Windows command prompt to determine the port number in use by a particular application. On a computer running the application as a service (server side), look for the application in the "listening" state, and check the "Local Address" column to find that application's port number. On a computer trying to connect to the service (client side), open the application to establish the connection, and then run the "netstat -abn" command. Look for the application in the "established" state, and find that application's port number in the "Foreign Address" column.

Step

This is harder to do for Linux or Mac, but the command "lsof -i" will sometimes show you the applications and the tcp ports they use.

Step

Find the non-standard port number that was configured on the server. Do this by using one of the previous methods or by looking at the configuration preferences for the application running on the server. If you do not have access to the server, then ask the server's administrator which port number the application uses.