Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the process name and binary path for a open port with Qt on Windows?

I'm writing a port collision checking function. I need to determine:

  • if a certain port is open
  • the process name of the daemon
  • path of the binary of the daemon

My idea was to run a QProcess executing the native command netstat -abno and parsing the output. But the parameter -b requires elevated rights (UAC) and i don't want to bug users with an UAC prompt.

Is there a Qt lib out there providing such functionality? How would you implement this?

like image 858
Jens A. Koch Avatar asked Oct 24 '25 21:10

Jens A. Koch


1 Answers

you can use Tcpvcon.exe which is part of TCPView
TCPView Needs admin rights, tcpvcon does not
use with -an or -acn
you can even specify the application to check afterwards: e.g. Tcpvcon.exe -an Skype

originally found by Dane some time ago:

Use TCPView if you want a GUI for this. It's the old Sysinternals app that Microsoft bought out

like image 178
user3684363 Avatar answered Oct 27 '25 15:10

user3684363



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!