I try to figure out which ports a specific program uses if they send data to the internet. Is there a tool which is able to find this out? Or do I have to do package inspection by using wireshark?

Background: I try to create a priority rule on my fritz!box 7490 router, so that some computer games are seen as real-time applications and there are as less lags as possible e.g. if someone in the network decides to watch videos on youtube while I am playing online.

  • You do know in most cases opening a port for a program isn't required unless you explicitly closed the port. Most consumer routers don't do that.
    – Ramhound
    Commented Mar 25, 2017 at 17:26
  • I have to specify the port range which my computer game uses so that I can select that game for the priority rule. Thats why I need to know the ports.
    – Black
    Commented Mar 25, 2017 at 17:28
  • Netstat should provide you which ports are being used. Will have to use detective reasoning to figure it out though. Wireshark can also be used. Most documented programs also list which poets are used
    – Ramhound
    Commented Mar 25, 2017 at 17:32
  • 2
    Also, opening secondary ports will not improve your lag. Once a port is open, it remains open, and lag happens DURING the game, not at the start.
    – LPChip
    Commented Mar 25, 2017 at 17:40
  • 1
    I do not try to port forward. I try to setup QoS... I already figured out the port by using wireshark. It says Destination Port 27022
    – Black
    Commented Mar 25, 2017 at 18:01

3 Answers 3

  1. Determine PID of your program

    tasklist | find "myprogram.exe"
  2. Check ports in third column of output from

    netstat /a /n /o | find " 4564"
    • there is a space before PID to rule out inappropriate matches potentially coming from other columns (a little trick)
    • /n keeps addresses in numeric form (without resolving) what causes the command to finish without delays (it should suffice for what you need)
  • Or you can use the /b flag to netstat to list the names of the executables right there. However, note that it will only list executables you have permission for (unless you run it as admin).
    – Moshe Katz
    Commented Mar 27, 2017 at 22:01
  • @MosheKatz - /b flag was not suitable for this case because of use of simple filtering using find. If someone wants to browse through full listing or use some advanced row filtering technique, then they can go with /b, but otherwise /o is much more convenient.
    – miroxlav
    Commented Mar 28, 2017 at 8:34
  • I have one question left: netstat showed that GTA5.exe uses UDP Ports 6672, 17185 and 52164. Why is rockstar not mentioning 17185 and 52164? And why they say that we also need UDP Ports 61455, 61457, 61456 and 61458 plus TCP 80, 443 even though netstat does not show these ports? Im confused. Im referring to this article: support.rockstargames.com/hc/de/articles/…
    – Black
    Commented Apr 2, 2017 at 18:08
  • @Black - maybe you can post this as a new question so it will attract audience able to answer it correctly. Either on this site or on gaming.stackexchange.com. Maybe it is already answered there, perhaps also try searching a bit.
    – miroxlav
    Commented Apr 2, 2017 at 22:35
  • @miroxlav i searched the whole internet for it for a long time. But there are no official answers. I guess I have to ask the rockstar support but from my experience they distract and avoid to answer for whatever reasons.
    – Black
    Commented Apr 3, 2017 at 6:18

If you are using windows you can use the free utility "Process Explorer" for this - among many other things. You have to run it in Administrator mode though.

enter image description here


If you are wanting to optimize something like a game or netflix streaming, then you don't need to worry about the port on your computer - that is the client, and is (somewhat) randomly chosen from the higher range of ports. What you want is to find out what port(s) the service you are connecting to is provided on, and optimize connections to those ports from your machine (possibly by MAC address? or local lan ip)

Most game server browsers will show port information, or you can always connect to whatever service and then open a terminal window (start -> cmd.exe) and use netstat to find out what programs are connecting to what ports on what IP addresses. Here's a link to the docs for the windows version of it - https://commandwindows.com/netstat.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .