home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / admin / 4751 < prev    next >
Encoding:
Internet Message Format  |  1992-08-29  |  1.6 KB

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