home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!caen!sdd.hp.com!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.unix.admin
- Subject: Re: Choice of portnumbers
- Date: 28 Aug 1992 21:54:02 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 25
- Message-ID: <17m79qINNhih@early-bird.think.com>
- References: <1992Aug28.135134.26583@amcnix.amc.uva.nl>
- NNTP-Posting-Host: telecaster.think.com
-
- In article <1992Aug28.135134.26583@amcnix.amc.uva.nl> wetzels@amc.uva.nl (F.Wetzels) writes:
- >But if i want to use one of the 65536-1024 portnumbers for a certain
- >application, how can be sure that a conflict will not be created.
- >That is: someone else has choosen the same number but implemented for
- >a different protocol. How do i know this situation will not happen?
- >And, what portnumber should i use?
-
- Conflicts only occur if two servers on the same machine are trying to use
- the same port number. The easiest way to prevent this is to use a port
- number database.
-
- Most Unix systems have a file /etc/services, or something equivalent to it.
- This file maps symbolic names of application protocols to port numbers.
- Pick a port number that's not already listed there and use it. If you
- always use this scheme you'll never get a conflict. Your application
- should use getservbyname(3) to get its port number when it starts up.
-
- If you should ever install a package that has a conflicting port number
- hard-coded into it, you can resolve the conflict by changing the
- /etc/services entry and restarting your server.
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-