c++ - PID from socket number on Windows? -
I have to calculate the amount of bytes sent went and need to be received from the network by the various applications. At first I thought about using LSP, but there is a lot of do not use the LSP applications at all (for example SMB) is. That's why I wrote a little sniffer does it work on the application IP level and collect data from Rivofom. That's why I have the remote host, it's very good to know the local and remote ports, but I must also PID local socket boss, so it's no easy way to get PID ? Workaround To see GetTcpTable, GetUdpTable or AllocateAndGetUdpExTableFromStack and AllocateAndGetTcpExTableFromStack and results table (there are a lot of differences in functions between 2k, XP, XP SP2 and Vista), but it is using inelegant find disabled ... < / P> So what's the type of "GetPIDOfSocket" function? Resolution should only be WinAPI (no .net), since different languages can be used, such as C ++, Delphi.
Sorry to tell you this, but GetTcpTable or Using the AllocateAndGetTcpExTableFromStack is not a solution, in fact, how other netstate-type applications work AFAIK there is no Win32 "GetPIDOfSocket" function, your only option port The table is on the voting using functions. But at least you can code it yourself and the netstat process is not to give the eggs.
See the SysInternals C source code for netstatp . There is not a lot of it and it is well worth a look.
Comments
Post a Comment