"Gianmaria Iaculo - NVENTA" <gianmaria.iATrpcnetPUNTO.itwrote
Hi,
anyone knows or have a software to count the number of open sockets on a
machine? I'm developng a socket server and need to monitor the corret
dispose of unused sockets.
Do you need to do this in code?
If you just need to check the open sockets on a machine, "Netstat.Exe" is
the way to go. You can run it from the command line.
I typically run, "netstat -a -o -n". This gives me a list of all open
sockets, doesn't to reverse dns on the endpoints (which takes forever) and
tells me the owning process for each socket (which I can then look up in
Task Manager by adding in the PID column). I'll often pipe this through find
to get a count: netstat -a -o -n | find /c "5222"
To do this in code, I believe you need to use WMI.
--
Chris Mullins, MCSD.NET, MCPD:Enterprise, MVP C#
http://www.coversant.net/blogs/cmullins