Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to enumerate remote socket ports

How to enumerate remote socket ports

Scheduled Pinned Locked Moved C / C++ / MFC
csharptutorialquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MarkLTX
    wrote on last edited by
    #1

    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.

    A R M 3 Replies Last reply
    0
    • M MarkLTX

      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.

      A Offline
      A Offline
      Ahmed Charfeddine
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • M MarkLTX

        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.

        R Offline
        R Offline
        Rajesh R Subramanian
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • M MarkLTX

          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.

          M Offline
          M Offline
          MarkLTX
          wrote on last edited by
          #4

          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.

          A 1 Reply Last reply
          0
          • M MarkLTX

            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.

            A Offline
            A Offline
            Adam Maras
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups