How to check and identify the ports used by other applications

in this example i want to introduce for this tutorial. Some times the Application Servers like Apache for Web Services its can't be running properly. The port of the server host was used by anothers application.

There are times that you might want to check which service or application is current using port 80 in windows. For me, this morning, I intended to start up grizzly server to test comet streaming server, however, there is an exception thrown.

After installing Apache HTTPD web server or Microsoft IIS Internet Information Services web server, or any other application software or service and daemon that requires to open and listen to port 80 (HTTP) or port 443 (HTTPS SSL), it’ll be a surprise if some other application or processes have stolen, used and occupied port 80 and/or 443. No web server has been running on the Windows system before, so what’s the process that uses port 80 or 443 on the system?

For example, after installing Apache web server using XAMPP, the following error message may appear:

(OS 10048) Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down.


The exception is quite easily to understand or guess. The port80 is already in use and grizzly simply can’t listen on the 80. Previously I met this problem as well. And when I type “localhost” in the browser address bar, it returns me the IIS default page. So I knew that the problem is IIS.

So I just needs to go to control panel and stop IIS server. However, this time, when I type “localhost” in the browser address bar, it returns me an empty page. Which means that there is indeed some program open my port 80 however, there is no index page to display. If the port 80 is no open and you type “localhost”, the browser should tell you that it is not able to connect to the server. So the next step is to find out which process is taking up my port 80. In ‘cmd’ window, type the following command:

netstat -o -n -a | findstr 0.0:80

So this is what it returns on my computer:
C:\Users\user>netstat -o -n -a | findstr 0.0:80
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4108
TCP 0.0.0.0:8090 0.0.0.0:0 LISTENING 2180
TCP 0.0.0.0:8091 0.0.0.0:0 LISTENING 2236
TCP 0.0.0.0:8092 0.0.0.0:0 LISTENING 2180
TCP 0.0.0.0:8093 0.0.0.0:0 LISTENING 2180
TCP 0.0.0.0:8094 0.0.0.0:0 LISTENING 2180

netstat -o option is to list the PID (process ID), so I know that the process with PID 4108 is listening on port 80. Now, go to task manager and search the process with PID 4108 and see what application was used this port.

Have a nice day...







ridwan amirudin

"Help young people. Help small guys. Because small guys will be big. Young people will have the seeds you bury in their minds, and when they grow up, they will change the world." "Never give up. Today is hard, tomorrow will be worse, but the day after tomorrow will be sunshine." Jack Ma

No comments:

Post a Comment