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
Showing posts with label Commands. Show all posts
Showing posts with label Commands. 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 ?
Read more...
Start / Stop Services in Windows & Linux
Windows
1) Windows Services can be started by net start
Windows Services can be stoped by net stop
Full list of the services can be found in the registry under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services . Registry can be opened by running Run->regedit
eg. net start DB2-0 ---> starting db2 service.
2) You can also start/stop by using Run->services.msc which will open the following window. You can select any services and start & stop by manualy.

Linux
1) service service name stop or start or restart or status
to stop/start/restart the service of httpd use the following commands.
service httpd stop
service httpd start
service httpd restart
service httpd status
2) All scripts for start/stop/restart of all services are are located in /etc/init.d directory . List of scripts of services can be seen by $ls /etc/init.d
so you can just go there and type the script name and either stop or start or restart
or /etc/init.d/ status or stop or start or restart
eg. /etc/init.d/httpd status ->to check httpd status.
/etc/init.d/httpd stop -> to stop httpd service.
/etc/init.d/httpd restart -> to restart httpd service.
To stop httpd service at startup you can use the chkconfig command:
chkconfig --levels 3 httpd off
1) Windows Services can be started by net start
Windows Services can be stoped by net stop
Full list of the services can be found in the registry under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services . Registry can be opened by running Run->regedit
eg. net start DB2-0 ---> starting db2 service.
2) You can also start/stop by using Run->services.msc which will open the following window. You can select any services and start & stop by manualy.
Linux
1) service service name stop or start or restart or status
to stop/start/restart the service of httpd use the following commands.
service httpd stop
service httpd start
service httpd restart
service httpd status
2) All scripts for start/stop/restart of all services are are located in /etc/init.d directory . List of scripts of services can be seen by $ls /etc/init.d
so you can just go there and type the script name and either stop or start or restart
or /etc/init.d/
eg. /etc/init.d/httpd status ->to check httpd status.
/etc/init.d/httpd stop -> to stop httpd service.
/etc/init.d/httpd restart -> to restart httpd service.
To stop httpd service at startup you can use the chkconfig command:
chkconfig --levels 3 httpd off
Read more...