Re: Picking an unused port number
On 20/10/10 21:02, Spud wrote:
This isn't really java-specific, but I've been posting here lately and
what the heck:
Are there any conventions out there for selecting what port(s) your app
should use for application-specific communication?
Our app runs on multiple servers that must communicate. We're using
http, but can't use port 80 because there is another webserver using it
on each server. (And we don't want to use more IPs than we have to, or
do something ugly like virtual hosts across processes.)
So we have to pick another port number. We could use 8080 like Tomcat,
but there might also be a Tomcat instance running that we don't control.
So, in general, is there any rule you should use when selecting a port
number, other than picking one > 1024?
Don't use a "well-known" port which is already assigned by IANA to
another application/protocol. Just because you don't currently use that
application/protocol doesn't mean you won't want to next week. Make it
configurable so you can move it to a different port if you have to.
On UNIX/Linux systems a fairly comprehensive list is available in
/etc/services, also available at the following URL:
http://www.iana.org/assignments/port-numbers.
--
Nigel Wade