Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am guessing that netstat shows apps and their ports that already have a connection and it doesn't show or can't show an app that is trying to open a connection.

If I have an app that's trying to connect to the net but is blocked by a firewall, how do I know which port it's trying to use?

share|improve this question
    
For what operating system? –  Chris W. Rea Sep 2 '09 at 19:52
    
Sorry.. for Windows –  Tony_Henrich Sep 2 '09 at 19:57

4 Answers 4

up vote 6 down vote accepted

You can use TCPView from Microsoft/Sysinternals.

TCPView

If you find it difficult to capture the port opening with that utility, than the best bet is to install and run Wireshark to get a network trace (assume you aren't talking about a local software-based firewall.

share|improve this answer
    
TCP view is pretty much a frontend for netstat; if the program can't connect, I don't think you'll see in in that. Wireshark is what you want. –  Dentrasi Sep 2 '09 at 20:23
1  
That depends. If the firewall is not closing the connection (just dropping packets), then TCPView will show SYN_SENT while it waits for the connection to be established. You can see the same in netstat, but you have to be quicker on the refresh. –  dlux Sep 2 '09 at 20:35

If it's a software firewall then make an exception for the whole application so that you can easily check with netstat or tcpview which port it's using. After that you can remove the exception and add a rule for that specific port

share|improve this answer
    
Can't do that. It's a firewall at work which I don't have access to. –  Tony_Henrich Sep 2 '09 at 20:22

From the command line you can use

netstat -ano

Then look at the Task Manager to see which PID corresponds to which port

share|improve this answer
    
Tried that and it didn't work thus my question. I ran a program which was trying to connect to the net and then the netstat command and tasklist | findstr pid and the app didn't show up. My conclusion is netstat shows established connections only. –  Tony_Henrich Sep 3 '09 at 4:21

Windows tool to find out which port an app is trying to use?

NirSoft's CurrPorts - network monitoring software that displays the list of all currently opened TCP/IP and UDP ports on your local computer. For each port in the list, information about the process that opened the port is also displayed, including the process name, full path of the process, version information of the process (product name, file description, and so on), the time that the process was created, and the user that created it.

enter image description here

CurrPorts allows you to close unwanted TCP connections, kill the process that opened the ports, and save the TCP/UDP ports information to HTML file , XML file, or to tab-delimited text file. CurrPorts also automatically mark with pink color suspicious TCP/UDP ports owned by unidentified applications (Applications without version information and icons)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.