Hello, I'm trying to make a program that will list all tcp/udp connections. I can get the actuall connections using GetTcpTable, GetUdpTable but how can I get the process that is associated with that connection?
thank you
Printable View
Hello, I'm trying to make a program that will list all tcp/udp connections. I can get the actuall connections using GetTcpTable, GetUdpTable but how can I get the process that is associated with that connection?
thank you
What OS?
Also, whats the point, netstat already does this?
windows xp, The reason I want to do this is I think it will be a usefull feature in my program.
Also, I did not ask how to get the connections, I asked how to get the process associated with that particular connection. I know this is possible because I have seen it done in other programs. 'active ports' for example.
I realise I named the topic wrong, sorry.
thanks
For windows the netstat option is -b to show what programs PID its associated with. As for how its implemented, I am unsure. I would bet their is a system call or something that gets information on what filedescriptors/sockets a program has open. I have no idea beyond that, all I can think of is to search through MSDN to see if they have any info on that posted. Ill let any one else with an idea post now.
I did manage to find something that does what I want, GetExtendedTcpTable, but it only works on xp sp2, and I want it to work on 98 - xp