portnumbers

This is a discussion on portnumbers within the Networking/Device Communication forums, part of the General Programming Boards category; If I have got it right, I can use any portnumber for my program? (In theory?) Like if im making ...

  1. #1
    Politics&Cpp geek Da-Nuka's Avatar
    Join Date
    Oct 2004
    Posts
    104

    portnumbers

    If I have got it right, I can use any portnumber for my program?
    (In theory?)

    Like if im making a chat server/client,
    I can actually make my chat clients/servers speak to each other through port 80?

    Or do I have to chose a "unserserved" portnumber?

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,262
    Yes, you can bind to any port that is not already in use, and is less than 65356. To bind to a port under 1024 requires root access on most *nix setups though.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    You can potentially bind to any port you want. The issue arises when it is a common port used for something else. Then other apps and services may not function correctly.

    Kuphryn

  4. #4
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    Ports are reverved for good reasons, you should not really use ports below 1024.
    Common ports: (invalid link removed)
    Last edited by iain; 02-27-2005 at 02:24 PM. Reason: bad link removed
    Monday - what a way to spend a seventh of your life

  5. #5
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    You can use any port EXCEPT 0 (commonly used by OS's to give you a random port actually, and is considered reserved by IANA). As it was mentioned most *nix variants protect ports 1024 and below. I would suggest using an unreserved port any ways though, as you don't have to worry about steping on any toes (so to speak), incase it is being used.

    Iain, I don't see any ports listed on that site, a beter choice would to just go to the source (IANA) any how, as they keep the up to date list on the web. This can be found at http://www.iana.org/assignments/port-numbers



    Oh, and some trivia, can you guess who got the port 666 assigned to them?
    Last edited by Xipher; 02-27-2005 at 02:27 PM.
    If any part of my post is incorrect, please correct me.

    This post is not guarantied to be correct, and is not to be taken as a matter of fact, but of opinion or a guess, unless otherwise noted.

  6. #6
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    sorry, wrong link!
    Monday - what a way to spend a seventh of your life

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21