chacham15
chacham15

Reputation: 14281

How do I find out what process opened what port?

I want a method of finding out what process opened what port without the aid of an external application. I.e. no netstat or other tools like it.

Upvotes: 0

Views: 175

Answers (1)

Mike Kwan
Mike Kwan

Reputation: 24477

You need to use the IP helper functions. More specifically GetExtendedTcpTable and GetExtendedUdpTable.

For example, for GetExtendedUdpTable, you can pass in MIB_UDPTABLE_OWNER_PID as the TableClass and you will be able to receive the PID of the process that issued the call to bind for the UDP endpoint.

Upvotes: 2

Related Questions