home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / ultrix / 5923 < prev    next >
Encoding:
Text File  |  1992-07-27  |  3.1 KB  |  64 lines

  1. Newsgroups: comp.unix.ultrix
  2. Path: sparky!uunet!mcsun!sunic!liuida!isy!lysator.liu.se!pen
  3. From: pen@lysator.liu.se (Peter Eriksson)
  4. Subject: Inetd, tcp & wait
  5. Message-ID: <1450@lysator.liu.se>
  6. Summary: What did they "fix" this time?
  7. Keywords: inetd ultrix tcp wait socket listen accept
  8. Sender: news@isy.liu.se (Lord of the News)
  9. Organization: Lysator Academic Computer Club, Linkoping University, Sweden
  10. Date: Tue, 28 Jul 1992 01:57:55 GMT
  11. Lines: 51
  12.  
  13. A nice feature I've found and that I like a lot on some Inetd implementations
  14. is the possibility to use "tcp" together with "wait". This is normally not
  15. a possible combination according to most manual pages, but it works anyway.
  16.  
  17. What this combination does (or should do) is that it create a tcp socket,
  18. binds it to a certain port (specified by the service), does an accept()
  19. on it and the waits for a connection to be established.
  20.  
  21. When a connection is established it forks and passes as file descriptor
  22. 0 (zero) the socket. The client can then go into a look and do a number
  23. of "accept()"'s on it to receive and handle this and future connections.
  24.  
  25. Why would one wanna do this? Well, for two reasons. First it will automatically
  26. start a server at the first connection attempt. Then the server can handle
  27. this and some future connections to the service and if it decides to shut
  28. itself down or dies because of a bug, then Inetd will start a new copy
  29. of the server at the first next connection attempt. This will reduce the
  30. load on the machine running this service.
  31.  
  32. This works just great under SunOS, HP-UX (except HP-UX 7.0, where the
  33. engineers at HP decided to throw in an extra check to make sure that
  34. noone would dare to use "tcp" together with "wait" - let's blast the poor
  35. user with an ERROR MESSAGE instead. :-), Sequents Dynix 2.1.1 and possibly
  36. others.
  37.  
  38. Now to my problem. It doesn't work under Ultrix 4.2, but I'm not getting any
  39. userfriendly error messages like under HP-UX 7.0. Instead the
  40. call to "accept(2)" fails with an EINVAL, and error code that according
  41. to the manual page can't be generated by "accept(2)"... Great.
  42.  
  43. I look at the BSD-net2 sources and there it looks like "accept(2)"
  44. can generate the EINVAL error if the SO_ACCEPTCONN" flag isn't set
  45. in the so->so_options structure member. SO_ACCEPTCONN is set when
  46. one calls "listen(2)", if some other structure member "so->so_q" is
  47. non-null after the protocol-specific PRU_LISTEN routine has been called
  48. and no error occured in that... Not that this information helped me much
  49. since I have no way of knowing if Ultrix does it this way, or what it
  50. means if it does it. I guess that somehow the Ultrix Inetd isn't doing
  51. the call to "listen(2)" but I'm not sure...
  52.  
  53. Perhaps some Ultrix guru could explain what's happening to a poor
  54. non-Ultrix hacker? (The software I'm trying to get to run is my
  55. implementation of a RFC931/IDENT/TAP protocol server, Pidentd).
  56.  
  57. /Peter
  58.  
  59.  
  60. --
  61. Peter Eriksson                                              pen@lysator.liu.se
  62. Lysator Academic Computer Society                 ...!uunet!lysator.liu.se!pen
  63. University of Linkoping, Sweden                           I'm bored. Flame me.
  64.