Path: utzoo!attcan!uunet!lll-winken!lll-ncis!helios.ee.lbl.gov!pasteur!ames!oliveb!pyramid!prls!philabs!linus!mbunix!dsg From: dsg@mbunix.mitre.org (David S. Goldberg) Newsgroups: comp.unix.wizards Subject: Re: Multiple connections on a single port? Message-ID: <43430@linus.UUCP> Date: 6 Jan 89 19:36:08 GMT References: <43380@linus.UUCP> Sender: news@linus.UUCP Reply-To: dsg@mbunix (Goldberg) Organization: The MITRE Corporation, Bedford, Mass. Lines: 50 In article <43380@linus.UUCP> I writes: > >I appologize if this question is incredibly simple or obvious... And after discovering my stupid mistake, I really appolgize :-) [problem with multiple connections being cued] >---------------------------------------------------------------------- > >main(argc,argv) >int argc; >char **argv; >{ [ no need to see all the gory details again] > g = accept(f,&from,&len); > } while (g < 0 && errno == EINTR); > from.sin_port = ntohs((u_short)from.sin_port); > hp = gethostbyaddr(&from.sin_addr, sizeof (struct in_addr), > from.sin_family); > hname = (char *) malloc(strlen (hp->h_name) + 1); > strcpy(hname,hp->h_name); > if (approved(hname)) { /* only certain hosts can connect */ > if ((pid = fork()) == 0) { > close(f); > authenticate(g); /* routine talks to client*/ > return; ^^^^^^^ ARRGH I should have used exit. And looking through my RCS logs, I found that at one point I had. I don't even remember changing it. I think the reason why is that the descriptor g doesn't close properly, but could someone tell me for sure? > } > close(g); > } > else close(g); Thanks, -dave -------------------------------------------------------------------------- Dave Goldberg ARPA: dsg@mitre.org The Mitre Corporation MS B020 UUCP: linus!mbunix!dsg Bedford, MA 01730 617-271-2460