Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm creating an internal collaboration tool that will use a central server (on an intranet) and one or more ports for socket communication to clients. I know that many ports are reserved for particular purposes and others are conventionally used for certain types of traffic.

How should I go about picking a default port that is least likely to have been "claimed" by someone else for their tool? Is there a database that identifies all known (even unconventional) port usage?

share|improve this question
3  
This is generally only an issue if something is already using the port on the server. However, the port should be configurable. I've seen quite a lot of software have hardcoded ports, which is not what you want. –  devicenull Jul 4 at 1:51
    
@devicenull I'll definitely have the option to override the default. –  Jace Browning Jul 4 at 2:12
3  
If your beard is gray enough, you could use RPC and register your own endpoint. msdn.microsoft.com/en-us/library/windows/desktop/… –  Ryan Ries Jul 4 at 2:38
2  
Unless you have a great reason not to it is better to use existing protocols where you can. a) It is natural to think you can do a better job, for most people that is not true. But even when you can, is it better enough to counteract b) network tools/devices are already setup to work with existing standards. Adding new ones has a barrier and amount of work to do to implement. –  JamesRyan Jul 4 at 11:08
2  
For something that is internal collaboration anything > 1024 and < 32768 (should protect against ephemeral port bindings) and NOT listed in the IANA port registry would be OK, providing you communicate effectively to your internal depts you have taken the port. –  Matthew Ife Jul 4 at 19:21

2 Answers 2

up vote 16 down vote accepted

Yes, IANA maintains the official service and port number registry.

The process for getting a port number assigned to you is documented in RFC 6335. A review process is required for any port assignment, but it is much stricter for ports < 1024; such assignments require (among other things) that your protocol is documented in an RFC.

(Note that this process is relatively new and that there are many assigned ports which were grandfathered in.)

For < 1024, ports 1021 and 1022 are reserved for experimentation; above that, for experimentation you can simply use a dynamic port >= 49152.

share|improve this answer
    
Shortcut to search for "unassigned": iana.org/assignments/service-names-port-numbers/… –  Jace Browning Aug 9 at 23:20

In most cases it is better to just use HTTP, as sooner or later there will be a firewall you need to cross. Most OSs allow the HTTP address space to be divided up between processes.

share|improve this answer
2  
I'm confused, can't I use HTTP over any port? I don't want to default to :80 or :8080 because there is a strong possibility those will already be in use. Isn't my question still valid? –  Jace Browning Jul 4 at 15:50
    
@JaceBrowning, yes you can, but using any other port is just a odd bit of history :-). Any decent OS, will let you divide up the HTTP namespace between applications. –  Ian Ringrose Jul 4 at 22:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.