Path: utzoo!attcan!uunet!ginosko!xanth!mcnc!rti!sas!kent From: kent@sas.UUCP (Paul Kent) Newsgroups: comp.protocols.tcp-ip Subject: novice TCP-IP / UNIX questions Message-ID: <1149@sas.UUCP> Date: 15 Aug 89 02:01:21 GMT Reply-To: kent@sas.UUCP (Paul Kent) Distribution: comp.protocols.tcp-ip Organization: SAS Institute Inc, Cary NC Lines: 94 hello, this is a first posting, so please be gentle if i screw up. I have written a client/server pair of programs modelled on the whois_client/whois_server pair in "Internetworking with TCP/IP" by Douglas Comer. (a very useful book, thanks!) For those who might help, but do not have the book, the server does this (and a bit of error checking too :-) hp = gethostbyname(host); s = socket(hp->h_addrtype, SOCK_STREAM, 0); bind(s, &sa, sizeof(sa) ); listen(s, 5); for(;;) { t = accept(s, .. read(t, ...) process(...) write(t, ...) close(t) } while the client does this: hp = gethostbyname(host); s = socket(hp->h_addrtype, SOCK_STREAM, 0); connect(s, &sa, sizeof(sa) ); write(s, ...) read(s, ...) exit(0) Under Apollo bsd4.2 (SR9.7 and SR10) , as well as Ultrix (RISC), they work nicely if i start the server in one shell, and then run the client in another. I am interested in having inetd start my tcp server process, as soon as it hears a request from a client. This is where the wheels fall off. My pair of programs use the "well known" (to the pair at least) service "pmka", whose entry in /etc/services is: pmka 601/tcp # See Paul Kent The entry in inetd.conf is: (the executable is not owned by root) pmka stream tcp nowait /udr/saspmk/tcp/com/pmkad pmkad 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? -or am i supposed to bind it in some fashion? example fragments most welcome... i have no unix source access or i would snoop around ftpd and telnetd ditto for things your mother should have told you about inetd spawned servers, but forgot to. Question 2: any tips on how to debug a process launched by inetd? Question 3: i ultimately want to write client/server code to support communications between two SAS sessions via the internet. (SAS/Share and micro-to-host link if you know our products) how do i request that a well know number be assigned to my/SAS's application? Thank You Paul R&D -- applications -- ---- nothing ventured, nothing disclaimed ---- paul kent, SAS Institute, box 8000, cary nc 27512-8000 -- 919 467 8000 .... {seismo|mcnc}!rti!sas!kent or kent@sas.UUCP