How to enumerate remote socket ports
-
Is there a way in C or C# to enumerate the port numbers in listening state on a remote Windows computer? I know you can use GetTcpTable() to enumerate the ports on the local computer, but I want remote.
I do'nt think this is possible. Some applications called port scanners (like SATAN) give result by looping on a all port numbers within a specified range, initiate a connection i,n each time then decide using the reply result.
Easy Profiler : a compile-time profiler for C++ www.potatosoftware.com
-
Is there a way in C or C# to enumerate the port numbers in listening state on a remote Windows computer? I know you can use GetTcpTable() to enumerate the ports on the local computer, but I want remote.
Like the other poster said, you could do a port scan, or run your client on the other end and that should send you a snapshot of the ports that the computer is listening on.
It is a crappy thing, but it's life -^ Carlo Pallini
-
Is there a way in C or C# to enumerate the port numbers in listening state on a remote Windows computer? I know you can use GetTcpTable() to enumerate the ports on the local computer, but I want remote.
OP here. There can be multiple instances of my app running on computer A, each listening on a different port. On computer B, I want to run a monitor app that can connect to any of the app instances running on computer A. It would be nice if I could enumerate those instances rather than having to just "know" what port(s) are listening. What I might do is code my application to use a limited range or list of ports (say 100 fixed port numbers) and then code the monitor app to simply scan that list.
-
OP here. There can be multiple instances of my app running on computer A, each listening on a different port. On computer B, I want to run a monitor app that can connect to any of the app instances running on computer A. It would be nice if I could enumerate those instances rather than having to just "know" what port(s) are listening. What I might do is code my application to use a limited range or list of ports (say 100 fixed port numbers) and then code the monitor app to simply scan that list.
Perhaps you could select one specific standard port as a "management" port; computer B could open a connection to the standard port, and computer A would send back a list of its own open ports.
Adam Maras | Software Developer Microsoft Certified Professional Developer