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
0 comments:
Post a Comment