How to know which Local Application Connected to my socket (Windows) -
I have a Windows service that links to some TCP ports, this port is used for IPC between my app.
Is any programming (WinAPI / WinSocket and etc.) the way to find out which port is connected to my port?
In my Windows services, I would like to get a PID of the process connecting to my port.
If you are looking for a way to do WinAPI like the netstat Probably want the following APIs:
See results with result TCP_TABLE_OWNER_PID_ALL .
The resulting MIB_TCPTABLE_OWNER_PID structure has many structures with the dwOwningPid process ID you are looking for.
Comments
Post a Comment