[windows] How to make sure that a certain Port is not occupied by any other process

I am working on a Java EE Application in a Windows environment. (I am using Windows 7)

I am using Tomcat Server, unfortunately port number 8080 is busy (used by Oracle). Now I want to assign a different port to Tomcat.

So before changing inside conf/server.xml file, I want to make sure that a certain port is not occupied by any other process and it's free.

This question is related to windows networking

The answer is


It's (Get-NetTCPConnection -LocalPort "port no.").OwningProcess


It's netstat -ano|findstr port no

Result would show process id in last column


netstat -ano|find ":port_no" will give you the list.
a: Displays all connections and listening ports.
n: Displays addresses and port numbers in numerical form.
o: Displays the owning process ID associated with each connection .

example : netstat -ano | find ":1900" This gives you the result like this.

UDP    107.109.121.196:1900   *:*                                    1324  
UDP    127.0.0.1:1900         *:*                                    1324  
UDP    [::1]:1900             *:*                                    1324  
UDP    [fe80::8db8:d9cc:12a8:2262%13]:1900  *:*                      1324