6

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.

7
  • 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
    Mar 25 '17 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
    Mar 25 '17 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
    Mar 25 '17 at 17:32
  • Google "name of the game" port forwarding. You will find out which ports you need to open exactly. They are common ports for engines used by games, so its not really that hard to figure out.
    – LPChip
    Mar 25 '17 at 17:39
  • 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
    Mar 25 '17 at 17:40
9
  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)
5
  • 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
    Mar 27 '17 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
    Mar 28 '17 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
    Apr 2 '17 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
    Apr 2 '17 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
    Apr 3 '17 at 6:18
6

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

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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