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