How do I find which application is using up my port?

I am unable to start GlassFish, because it keeps showing this error message:

SEVERE: Shutting down v3 due to startup exception : No free port within range: 8080=com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectorHandler@ed7d1

How can I find what applications are using what ports on Windows Vista? I have tried using nmap zenmap using the following target:

http://127.0.0.1:8080

But all I get is this:

Starting Nmap 5.51 ( http://nmap.org ) at 2011-08-05 12:05 Central Daylight Time


NSE: Loaded 57 scripts for scanning.


Read data files from: C:\Program Files\Nmap
Nmap done: 0 IP addresses (0 hosts up) scanned in 4.55 seconds
Raw packets sent: 0 (0B) | Rcvd: 0 (0B)
WARNING: No targets were specified, so 0 hosts scanned.
271437 次浏览

To see which ports are available on your machine run:

C:>  netstat -an |find /i "listening"

On the command prompt, do:

netstat -nb

How about netstat?

http://support.microsoft.com/kb/907980

The command is netstat -anob.

(Make sure you run command as admin)

I get:

C:\Windows\system32>netstat -anob

Active Connections

     Proto  Local Address          Foreign Address        State           PID
TCP           0.0.0.0:80                0.0.0.0:0                LISTENING         4
Can not obtain ownership information


TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       692
RpcSs
[svchost.exe]


TCP    0.0.0.0:443            0.0.0.0:0              LISTENING       7540
[Skype.exe]


TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4
Can not obtain ownership information
TCP    0.0.0.0:623            0.0.0.0:0              LISTENING       564
[LMS.exe]


TCP    0.0.0.0:912            0.0.0.0:0              LISTENING       4480
[vmware-authd.exe]

And If you want to check for the particular port, command to use is: netstat -aon | findstr 8080 from the same path

It may be possible that there is no other application running. It is possible that the socket wasn't cleanly shutdown from a previous session in which case you may have to wait for a while before the TIME_WAIT expires on that socket. Unfortunately, you won't be able to use the port till that socket expires. If you can start your server after waiting for a while (a few minutes) then the problem is not due to some other application running on port 8080.