Path: utzoo!utgpu!watmath!iuvax!purdue!mentor.cc.purdue.edu!dls From: dls@mentor.cc.purdue.edu (David L Stevens) Newsgroups: comp.protocols.tcp-ip Subject: Re: novice TCP-IP / UNIX questions Message-ID: <3656@mentor.cc.purdue.edu> Date: 15 Aug 89 16:55:13 GMT References: <1149@sas.UUCP> Reply-To: dls@mentor.cc.purdue.edu (David L Stevens) Distribution: comp.protocols.tcp-ip Organization: PUCC UNIX Group Lines: 19 inetd(8) does the accept(2) for you; descriptor 0 is an ESTABLISHED state (as opposed to LISTEN state) TCP socket. Re: debugging. I found it useful to write some inetd-like functions that do the accept(2) and dup2(2) it onto descriptor 0. I then used "#ifdef DEBUG"'s to include or exclude the function that does the setup. The remaining code (the server proper) works the same with or without inetd. Further, you can do dbx-debugging easily if the accept is done in the same process (ie, no fork(2) after the accept(2)). When it works, just recompile without "DEBUG" defined and you're done. The code I have is for a particular server I'm working on, so it's not really worth posting, but it is easily adapted and I'll send it on request to anyone who asks (via mail). Actually, reproducing it yourself isn't a bad exercise in using sockets, either... -- +-DLS (dls@mentor.cc.purdue.edu)