If I have got it right, I can use any portnumber for my program?
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? :confused:
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.
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.
Ports are reverved for good reasons, you should not really use ports below 1024.
Common ports: (invalid link removed)
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?