I have a .Net application that maintains a socket pool to reuse them. It is suspected that it might be holding too many of those sockets without releasing them. Is there a way to find the number of socket handles the application is holding to in Windows?
If you need to determine the current state of the connection, make a nonblocking, zero-byte Send call. If the call returns successfully or throws a WAEWOULDBLOCK error code (10035), then the socket is still connected; otherwise, the socket is no longer connected.
Type netstat -a -o -n -b
from an elevated (admin) command prompt.
-b
is to display the executable involved in creating each connection or listening port. See netstat --help
for a list of all options.
I like TCPView from SysInternals: http://technet.microsoft.com/en-us/sysinternals/bb897437 Good for lots of other things too, but to check your own process out, just find it in the list and look at the sockets it has open, addresses they are bound to, etc. You can also watch the dynamic pattern of your processes socket usage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With