home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / solaris / 505 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.7 KB

  1. Xref: sparky comp.unix.solaris:505 comp.sys.sun.apps:3125
  2. Path: sparky!uunet!ukma!bogus.sura.net!howland.reston.ans.net!usc!news.service.uci.edu!ucivax!schmidt
  3. From: schmidt@liege.ics.uci.edu (Douglas C. Schmidt)
  4. Subject: different semantics for listen(2)
  5. Nntp-Posting-Host: liege.ics.uci.edu
  6. Message-ID: <2B6854CB.19235@ics.uci.edu>
  7. Newsgroups: comp.unix.solaris,comp.sys.sun.apps
  8. Reply-To: schmidt@ics.uci.edu (Douglas C. Schmidt)
  9. Organization: University of California at Irvine: ICS Dept.
  10. Lines: 33
  11. Date: 28 Jan 93 21:49:00 GMT
  12. Distribution: inet
  13.  
  14.  
  15. Hi,
  16.  
  17.     I just finished porting the TCP benchmark test program "ttcp"
  18. to Solaris 2.1.  As a result of this, I learned an interesting and
  19. subtle difference between the semantics of the BSD listen(2) system
  20. call in both systems.  It is worth remembering in case you are porting
  21. old BSD socket code to Solaris, so I'd like to share it.
  22.  
  23.     In the ttcp source there is the following comments and code:
  24.  
  25. ----------------------------------------
  26.       /* otherwise, we are the server and
  27.            * should listen for the connections
  28.            */
  29.       listen (fd, 0);    /* allow a queue of 0 */
  30. ----------------------------------------
  31.  
  32.     In Sun OS 4.1.x this idiom seems to work fine.  However, with
  33. Solaris 2.1 having a 0-sized listen queue causes the server to reject
  34. client connection requests.  Changing the value to 1 fixes the
  35. problem...  After reading the manual page it is unclear which is the
  36. "correct" behavior.  Although it certainly seems plausible that Solaris
  37. is doing it "right" there is an issue of backwards compatibility here!
  38.  
  39.     Hope this helps someone out someday!
  40.  
  41.         Doug
  42. --
  43. Douglas C. Schmidt
  44. Department of Information and Computer Science
  45. University of California, Irvine
  46. Irvine, CA 92717. (714) 856-4105
  47.