Path: utzoo!utgpu!watmath!att!pacbell!rtech!wrs!hwajin
From: hwajin@wrs.wrs.com (Hwajin Bae)
Newsgroups: comp.protocols.tcp-ip
Subject: Re: novice TCP-IP / UNIX questions
Message-ID: <744@wrs.wrs.com>
Date: 15 Aug 89 17:47:15 GMT
References: <1149@sas.UUCP>
Reply-To: hwajin@wrs.wrs.com (Hwajin Bae)
Distribution: comp.protocols.tcp-ip
Organization: Wind River Systems, Emeryville, CA
Lines: 20

In article <1149@sas.UUCP> kent@sas.UUCP (Paul Kent) writes:
>now, the inetd man page says that it starts the client with a socket
>descriptor of 0 for the service requested.
>Question 1:  do i accept connections on descriptor 0, 
>       -or-  do i read/write it hoping that inetd accepted
>             the connection for me?

Inetd will automaticallly dup descriptor 0 to be the new socket 
connection established.  You can safely assume that the descriptor 0 will
be the socket descriptor for the connection you desire on the server side.
To be able to find out the address of the remote peer who just made a
connect() call to the server (invoked by the inetd), you can use 
getpeername() call.


-- 
Hwajin Bae
Wind River Systems
1350 Ocean Ave
Emeryville, CA 94608