home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / programm / 5772 < prev    next >
Encoding:
Text File  |  1992-12-24  |  1.9 KB  |  46 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!think.com!yale.edu!jvnc.net!aggarwal
  3. From: aggarwal@tigger.jvnc.net (Vikas Aggarwal)
  4. Subject: Question on daemon's under inetd
  5. Message-ID: <1992Dec24.064005.5831@tigger.jvnc.net>
  6. Summary: Want to make daemons from inetd wait for a period of time
  7. Originator: aggarwal@nisc.jvnc.net
  8. Keywords: inetd daemons
  9. Sender: news@tigger.jvnc.net (Zee News Genie)
  10. Nntp-Posting-Host: nisc.jvnc.net
  11. Organization: JvNCnet
  12. Date: Thu, 24 Dec 1992 06:40:05 GMT
  13. Lines: 31
  14.  
  15. In the past, I have come across several inetd daemons that are
  16. started up by inetd when a connection on the particular port
  17. comes in, and then *wait* for a small period of time
  18. listening for any more incoming connections on their port before
  19. exiting after a period of inactivity.
  20.  
  21. To me, this seems like an excellent idea- achieves the best of both
  22. arguments (standalone via inetd daemon-- startup time vs. inactivity).
  23.  
  24. However (obviously), when I tried to do the same with a TCP daemon
  25. that I wrote, the 'accept' call errored with 'socket not connected'.
  26. I was doing an 'accept' on the file descriptor 0 handed to me by
  27. 'inetd'. Processing the first connection worked fine, but then I went
  28. back to listening on the stdin (file desc 0 handed by inetd), the
  29. accept() call returned immediately.
  30.  
  31. I tried playing around with the 'wait' vs. 'nowait' in the inetd.conf
  32. file, but that did not help. Do I have to set some option on the
  33. stdin/socket or open another socket and bind to it (as I would do in
  34. a standalone server) ? Can't I reuse the file descr 0 handed to me by
  35. 'inetd' ??
  36.  
  37. Thanks, and appreciate emailing responses back to me also. Apologies if
  38. this is an easy one and been discussed already.
  39.  
  40.  
  41. -vikas                            Network Engineering
  42. vikas@jvnc.net                        (609) 258-2403
  43. ...rutgers!jvncnet!vikas                (609) 258-2424 (fax)
  44.             JvNCnet, Princeton, NJ
  45. -----------------------------------------------------------------------------
  46.