Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What range does INADDR_ANY use? (i.e. How should I select port)

12 views
Skip to first unread message

Mister B

unread,
Nov 19, 2009, 5:50:53 AM11/19/09
to
I have inherited some software that uses an IP port number 50083 that
has been added to /etc/services (it's to start an xterm and get
another process to send the data), but I'm finding some other process
(not in my control - it's an Ingres process iigcc) is already using
the port.

1) I'm presuming the Ingres process has used INADDR_ANY - what range
does this select from?

2) In which range should I select my port. Process is not running as
root, so presumably should be > 1024. From googling, I've seen
suggestions up to 5000, 49152, 50000, 32767?

TIA
Mark

Barry Margolin

unread,
Nov 19, 2009, 8:18:10 AM11/19/09
to
In article
<0f8f9898-53f0-42a0...@v30g2000yqm.googlegroups.com>,
Mister B <mark.b...@thales-is.com> wrote:

> I have inherited some software that uses an IP port number 50083 that
> has been added to /etc/services (it's to start an xterm and get
> another process to send the data), but I'm finding some other process
> (not in my control - it's an Ingres process iigcc) is already using
> the port.
>
> 1) I'm presuming the Ingres process has used INADDR_ANY - what range
> does this select from?

I assume you mean IPPORT_ANY, i.e. it uses 0 and lets the OS select a
port.

It's implementation-dependent. On your system, it looks like it uses
the same range as for outgoing ephemeral ports, 32K-64K.

> 2) In which range should I select my port. Process is not running as
> root, so presumably should be > 1024. From googling, I've seen
> suggestions up to 5000, 49152, 50000, 32767?

Well-known ports should generally be below 32K.

Also, if you start your server before other applications, it will win
the race for the port.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE don't copy me on replies, I'll read them in the group ***

0 new messages