Re: how to implement multiple child "accept" within one socket..
Won-Ho Kye <whkye@softforum.co.kr> writes:
> [1 <text/plain; iso-2022-kr (7bit)>]
> Hi friends..!
>
> I am implementing the server application which have serval child
> process.
><snip>
>
> The childs are forked from parent.
> I oberved if the each child accept the socket simultaneous,
> then the "accept" failed..
> Then I use the semophore to prevent simultaneous acception between
> child processes.
> Is there other efficient method?
Have you looked at the apache source? It will do something like this
(that is, apache's main process will fork several different children
at startup, and the children do the actual handling of the
connections). If I remember correctly, apache somehow manages to have
the parent process do the actual accept, and then pass it off to the
child. (It somehow does this without re-doing a fork() after the
accept).
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: