Please see my other blog for Oracle EBusiness Suite Posts - EBMentors

Search This Blog

Note: All the posts are based on practical approach avoiding lengthy theory. All have been tested on some development servers. Please don’t test any post on production servers until you are sure.

Sunday, December 12, 2010

How Check a specific port , is it being used

PORT NUMBERS

The port numbers are divided into three ranges: the Well Known Ports, the Registered Ports, and the Dynamic and/or Private Ports.

  • The Well Known Ports are those from 0 through 1023.
  • The Registered Ports are those from 1024 through 49151.
  • The Dynamic and/or Private Ports are those from 49152 through 65535.
 WELL KNOWN PORT NUMBERS
 The Well Known Ports are assigned by the IANA and on most systems can only be used by system (or root) processes or by programs executed by privileged users.
REGISTERED PORT NUMBERS
The Registered Ports are listed by the IANA and on most systems can be used by ordinary user processes or programs executed by ordinary users. 

The following command can help users to find out and identify which application
or process that is already using, opening and listening on port 80 or 443 on the Winodws operating system
C:\Documents and Settings\inam>netstat -o -n -a | findstr 0.0:80
  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       5100
  TCP    0.0.0.0:8081           0.0.0.0:0              LISTENING       1604
  UDP    0.0.0.0:8081           *:*                                    1604
  UDP    0.0.0.0:8082           *:*                                    1604
The last column of each row is the process identified (process ID or PID).

D:\ORACLE_MT\opmn\bin>netstat -aon   -- all connection that is listening

 C:\Documents and Settings\inam>netstat -b  (to find the executable using that port)

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    oamr-pc3:1247          localhost:1248         ESTABLISHED     3840
  [firefox.exe]

C:\Documents and Settings\inam>netstat -p TCP  ((or other protocol name)

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    oamr-pc3:1247          localhost:1248         ESTABLISHED
  TCP    oamr-pc3:1248          localhost:1247         ESTABLISHED
  TCP    oamr-pc3:1249          localhost:1250         ESTABLISHED
  TCP    oamr-pc3:1250          localhost:1249         ESTABLISHED
  TCP    oamr-pc3:5152          localhost:1837         CLOSE_WAIT
  TCP    oamr-pc3:netbios-ssn   172.55.20.39:1680      ESTABLISHED
  TCP    oamr-pc3:microsoft-ds  172.55.20.36:1045      ESTABLISHED
  TCP    oamr-pc3:microsoft-ds  172.55.20.156:1691     ESTABLISHED
  TCP    oamr-pc3:microsoft-ds  or-01.domain:3408  ESTABLISHED

C:\Users\inam>netstat -an |find /i "listening"

Finding Application Port Number 
you may need to know the port number of any application if due to security (Firewall) , your application is not connected to some server.
1. Open the Task Manager and find the PID for some application like spotlihgt.exe
2. Open the command prompt and run the " netstat -o -n" command
3. Find the PID in command prompt and find out which port it's running on.



No comments: