Showing posts with label Ports. Show all posts
Showing posts with label Ports. Show all posts

Solution for Port already in use / Port already open. How to close a port in windows whis is in already in use or open ?

Sometimes you may get the error "port already in use" or "port already open" when you install a application or when you start any server . That means the mentioned port is used by an application. For Example you may get the following error when you start the test server in WSAD .



This is due to, we may have terminated the WSAD by using Task Center when it is not responding. When you again load WSAD , starting the test server will the above error. This can be solved either by restarting the system or Stopping / Killing the process which uses the port . The same error may also occur when you install new application or when you run a java program (Socket Programming), in this situation you can use new port or if you want to use the same port means , you have to kill the process which uses the port.

Steps to end / stop / kill the process which uses the port
First find out the process id of process / application which is using port . To find out the process id of a process using the port no

netstat -aon | findstr "<port number>"
For example to find the process id of the application which is using the port 9080 , use the following command

C:\>netstat -aon | findstr "9080"

When you run the above command ,if the port 9080 is already used , then the following output is displayed

TCP 0.0.0.0:9080 0.0.0.0:0 LISTENING 3800

The number in the last column is the process id (PID) of the process holding the socket. That is 3800

Once PID is known, one can kill the application which corresponds to the PID using "Windows Task Manager" . (Note : to display the PID value in Task Manager, go to Processes tab, open View menu, then Select Columns)

or Using Command prompt to kill the process using process id , you can use the following command

taskkill /PID processid

Command to kill the processid 3800 , use the following command

c:\> taskkill /PID 3800


Read more...

How to find Which Port is in use in Windows?

Command : netstat -a -b -v

- displays all ports which are in use.
- displays which applicatiosn use which ports

The following is the output of the command . test-pc is the name of the PC.

TCP test-pc:9090 test-pc:0 LISTENING 5628
[javaw.exe]

in the above output , 9090 is the port which is used by javaw.exe.

Some more outputs of the command.

TCP test-pc:523 test-pc:0 LISTENING 396
[db2dasrrm.exe]

TCP test-pc:912 test-pc:0 LISTENING 4044
D:\WINDOWS\system32\WS2_32.dll
E:\Program Files\VMware\VMware Workstation\vmware-authd.exe
D:\WINDOWS\system32\kernel32.dll
[vmware-authd.exe]

TCP test-pc:1998 test-pc:0 LISTENING 6904
[javaw.exe]

TCP test-pc:2000 test-pc:0 LISTENING 5628
[javaw.exe]

TCP test-pc:5900 test-pc:0 LISTENING 3524
[tvnserver.exe]

TCP test-pc:6789 test-pc:0 LISTENING 3180
[db2jds.exe]

TCP test-pc:9090 test-pc:0 LISTENING 5628
[javaw.exe]

TCP test-pc:9094 test-pc:0 LISTENING 5628
[javaw.exe]

TCP test-pc:9095 test-pc:0 LISTENING 5628
[javaw.exe]

TCP test-pc:9096 test-pc:0 LISTENING 5628
[javaw.exe]

TCP test-pc:12345 test-pc:0 LISTENING 2808
[tmlisten.exe]

TCP test-pc:db2c_DB2 test-pc:0 LISTENING 4904
[db2syscs.exe]
Read more...

 
Copyright 2011 Java Online