Socket details using PID
-
Is there a way to tie a network connection to a PID (process ID) using Windows Socket functions? I would like to find network connection details associated with a particular process; more specifically in the process, port at which socket is listening and connection state I need to find. Any Windows Socket functions avialable to fetch all these details using VC++? TIA!
-
Is there a way to tie a network connection to a PID (process ID) using Windows Socket functions? I would like to find network connection details associated with a particular process; more specifically in the process, port at which socket is listening and connection state I need to find. Any Windows Socket functions avialable to fetch all these details using VC++? TIA!
It's not part of Winsock, but there is a library that can do what you want. Check out the IP Helper Functions (IpHlpApi). There are calls to fetch the active UDP & TCP listens/connections/etc (GetTcpTable & GetUdpTable). These return information that can be passed to GetOwnerModuleFromTcpEntry, GetOwnerModuleFromUdpEntry. Your best bet is to look up these functions on the msdn site.