finding port number

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • questionit
    Contributor
    • Feb 2007
    • 553

    finding port number

    How to find the port number for your PC ?

    i am writing a code which will send a message to some other machine.

    now just need to know the port number to use !!

    Thanks
  • manoj2814
    New Member
    • Aug 2007
    • 5

    #2
    How to find the port number for your PC ?

    Comment

    • questionit
      Contributor
      • Feb 2007
      • 553

      #3
      dont know

      port number is required.. if i write a code in C/C++ to send a message to another PC. i would need a port number as well.. which one that would be? and how will i get it

      Originally posted by manoj2814
      How to find the port number for your PC ?

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        A port is an endpoint of communication. I think it can be anything between 1 and 65k. Some of those numbers are reserved. Others are free to use. It is up to YOU to decide which port number you want to use. This means that you need to write a client and server software that monitors/sends data to that port. It's not simply finding out what port number a computer is. That's not what ports are. A computer has tens of thousands of ports. Port is a misnomer because it's not a physical thing. So, which port number do you use? Whatever number you want to use that's not already in use by another program. Pick a number, any number. You just have to write the code that will read from or send data to that port.

        Comment

        • yahiama
          New Member
          • Sep 2007
          • 1

          #5
          Originally posted by Rabbit
          A port is an endpoint of communication. I think it can be anything between 1 and 65k. Some of those numbers are reserved. Others are free to use. It is up to YOU to decide which port number you want to use. This means that you need to write a client and server software that monitors/sends data to that port. It's not simply finding out what port number a computer is. That's not what ports are. A computer has tens of thousands of ports. Port is a misnomer because it's not a physical thing. So, which port number do you use? Whatever number you want to use that's not already in use by another program. Pick a number, any number. You just have to write the code that will read from or send data to that port.

          I'm interested in that point too.I know that the printer takes port no. 1 ( I mean the LPT1 port) and I think that LPT2....Serial 1 ....all have a predetermined port no.in c++..
          I add my voice to the post...what are the port no. for serial ports and network adaptors..modem s and so on

          Comment

          • Cyberdyne
            Recognized Expert Contributor
            • Sep 2006
            • 627

            #6
            For a list of open ports on Windows you can go to a command prompt and enter:

            netstat -an

            then hit Enter

            Cyberdyne

            Comment

            Working...