简体   繁体   中英

Is it possible to get the thread Id of a process that is listening to a Port in Windows?

In windows we can list the ports that are currently used and the process that are listening to it using the netstat command. Just wondering if it is possible to find the exact thread id that opened the port inside the process?

I am looking for programmatic solutions like open process, IPC, etx. In windows if I inject a dll to the process I can get all the windows messages, however it does not include port related events.

hook socket , bind , listen , accept (and WSAXxx equivalents) and call GetCurrentThreadId() in the hook handlers. you can leverage eg MS Detours, EasyHook, or MHook etc to implement your handlers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM