Tuesday, November 28, 2017

Find port number used by a process in windows

If your process is launched in a java process, then sysinternal tools by itself is not easy enough to figure out the port used by your process, because there are usually many java processes running on a machine.

One way to get around this is

1>Create a unique local user on the machine

2>Start the process as that local user.
3>Launch procexp.exe in sysinternal tools and sort by username. Locate the only process running under the username created in step 1. Note its PID (process ID).
4>Launch tcpview in the sysinternal tools and locate the PID found in step 3. This will give you the port number used by the process.