EnumSockets?

bri189a

Senior Contributor
Joined
Sep 11, 2003
Messages
1,004
Location
VA
System.Net seems to be great if your building an application that will use ports to talk and send in a custom application... but what about Enumerating Sockets that are already in use by your local machine and what is using them....

Maybe there would be a typedef of called SocketPrograms:

int Socket; //socket being used 1-65536?
string Name; //program using socket ex:"Services"
direction Direction; //Inbound or Outbound

and the function would look like:
SocketPrograms [] EnumWorkingSockets();

I mean most firewalls are telling you that exact information... it seems like it would be pretty common thing to want to know... does anybody have any ideas how this would be done? I'm going to breaking out my Core SDK to look for hidden functions and try building it myself if no-one knows but I really hate messing with API's directly and would like to avoid it if possible.

Thanks.
 
Still hoping someone has something devloped already... but for those of you in the future who read this and are interested in the API, you are going to want to look for the GetTcpTable function in Iphlpapi.lib - this appears to be what is going to do exactly what I want above. I'll post any 'revelations' along the way.
 
Back
Top