bruxo00
bruxo00

Reputation: 133

How can I get the IP address that a specific process is connected to? (C#)

More precisely, I need to access these values that are shown on perfmon.exe:

enter image description here I've already tried netstat, performance counter, some other classes refering to networking, but I didn't end up with a method to access those values.

Thanks for the help!

Upvotes: 0

Views: 720

Answers (2)

Castorix
Castorix

Reputation: 1545

Among other APIs, Perfmon calls GetExtendedTcpTable with TCP_TABLE_OWNER_PID_CONNECTIONS flag

Upvotes: 1

someone
someone

Reputation: 29

Try WMI: ROOT\StandardCimv2:MSFT_NetTCPConnection

https://learn.microsoft.com/en-us/previous-versions/windows/desktop/nettcpipprov/msft-nettcpconnection

Upvotes: 1

Related Questions