An error in Stevens' Network Programming?

An error in Stevens' Network Programming?

Post by Martin Ste » Thu, 25 Mar 1993 20:20:49



Hello there!

I am currently writing a couple of servers that are started by inetd. I am
using a SunSparc II (SunOS 4.1.2).

Having read UNIX Network Programming, by W. Richard Stevens, it says (pp
336-337) that for a stream socket, inetd does a select() and then an
accept().

Believing this to be true, I wrote my server. And then spent hours wondering
why it didn't work.

Eventually, I tracked it down to the descriptors I inherited. It turns out I
have to accept() on the socket I get passed.

Is this an error in the book (and another piece of documentation I have, A
Network Primer,  but this does seem to be based heavily on Steven's book),
or just a peculiarity of Sun's implementation?

Thanks,
        Martin.

--
Martin N. Steed



 
 
 

An error in Stevens' Network Programming?

Post by Casper H.S. D » Thu, 25 Mar 1993 21:24:20



>I am currently writing a couple of servers that are started by inetd. I am
>using a SunSparc II (SunOS 4.1.2).
>Having read UNIX Network Programming, by W. Richard Stevens, it says (pp
>336-337) that for a stream socket, inetd does a select() and then an
>accept().
>Believing this to be true, I wrote my server. And then spent hours wondering
>why it didn't work.
>Eventually, I tracked it down to the descriptors I inherited. It turns out I
>have to accept() on the socket I get passed.
>Is this an error in the book (and another piece of documentation I have, A
>Network Primer,  but this does seem to be based heavily on Steven's book),
>or just a peculiarity of Sun's implementation?

No, you just put the wrong entry for your type of server in /etc/inetd.conf.
There are two possible types of tcp services that can be defined in
/etc/inetd.conf. The services with the nowait keyword. This
is the normal type of service as described in the book you mention.

This is the ``nowait'' type of service. In that case inetd will do the
accept and hand you the connected sockets. Examples are:

        telnetd, rlogind, fingerd, etc etc.

For each client a new single client serving program is started.

e.g.:

telnet  stream  tcp     nowait  root    /usr/etc/in.telnetd in.telnetd

The second type is the tcp service with the ``wait'' keyword. Only
for the first client the server is started. The server gets the
listening socket, otherwise it wouldn't be able to accept() more
than one client. In this case the server will serve a number of
clients at the same time.

I know no examples of this.

I assume you specified the wait keyword in /etc/inetd.conf whe you should
have specified the nowait keyword.

Casper

 
 
 

An error in Stevens' Network Programming?

Post by Rens Troo » Sat, 27 Mar 1993 08:27:19



   The second type is the tcp service with the ``wait'' keyword. Only
   for the first client the server is started. The server gets the
   listening socket, otherwise it wouldn't be able to accept() more
   than one client. In this case the server will serve a number of
   clients at the same time.

   I know no examples of this.

talkd.

-Rens

--
  __   ___  ,    __  
 /__) /__  /| / (    | J. Laurens Troost - Investment Management Services, Inc.
/  \ (___ / |/ __)   | *Opinions expressed herein are mine.  Mine, I tell you!*
-------------------------------------------------------------------------------

 
 
 

1. Stevens' book : UNIX network programming

Dear netter,

I'm Jehun Rhee, TA at CS Dept of Soongsil University.
I'm going to teach undergraduate students network programmming
with your book, UNIX Network Programming.

Is there any one who had any summarized paper or lecture note about it?
If there is one who had it, could you send me a copy of it?

Any information about it will be helpful to me.
I'll wait for your answer. Good bye.

                Sincerely yours,

2. Connor Tape and the missing ftape driver

3. Stevens' Network Programming

4. WANTED: Crypt for Delphi or Windows passwd DLL

5. Stevens' Unix Networking Programming, 2nd edition

6. modem driver

7. Help needed on Stevens' Unix Network Programming

8. neighbor table overflow

9. compiling examples from stevens 'advanced programming in unix' book.

10. Novice's socket query from Steven's networking book.

11. unix network programming by Stevens

12. A problem with compiling Unix Network Programming v1(Stevens)

13. 2nd Ed. Of Stevens Unix Network Programming?