Posted April 24, 201213 yr Hi All.I need some Win32 Api functions for enum all open port (TCP, UDP, etc) that can be implemented on XP, 7, or below. is there any function that i can be used for?
April 24, 201213 yr create tcp stream socket & try to connect() to it. Do that for all the ports in your range.I dont really see any other way...
April 24, 201213 yr You can use the IP helper library that is part of Windows, see this MSDN link:/>http://msdn.microsoft.com/en-us/library/windows/desktop/aa366071%28v=vs.85%29.aspx
April 26, 201213 yr create tcp stream socket & try to connect() to it. Do that for all the ports in your range.I dont really see any other way...trying to connect() to every possible existing port inside a loop is not a smart way....i'm with kao, GetTcpTable / GetExtendedTcpTable. Edited April 26, 201213 yr by rotem156
April 27, 201213 yr http://www.codeproject.com/Articles/5453/Enhance-netstatThe main idea of this project was already implemented and presented by some guys around here: using GetTcpTable and GetUdpTable to read connection states of running processes. Yet another thing that is mentioned in this kind of articles are two undocumented APIs from iphlpapi.dll: AllocateAndGetTcpExTableFromStack and AllocateAndGetUdpExTableFromStack. Using these APIs, we can get access to the name of the process that holds the running connection. Unfortunately it does work only with Win2000, WinXP or newer versions.Amazing what happens if you actually perform a Google search for something relating to this subject, like: "Detect open ports C++"HR,Ghandi
Create an account or sign in to comment