Forking with a listening socket
Posted
by viraptor
on Stack Overflow
See other posts from Stack Overflow
or by viraptor
Published on 2010-05-02T23:24:34Z
Indexed on
2010/05/02
23:27 UTC
Read the original article
Hit count: 161
I'd like to make sure about the correctness of the way I try to use accept() on a socket.
I know that in Linux it's safe to listen() on a socket, fork() N children and then recv() the packets in all of them without any synchronisation from the user side (the packets get more or less load-balanced between the children). But that's UDP.
Does the same property hold for TCP and listen(), fork(), accept()? Can I just assume that it's ok to accept on a shared socket created by the parent, even when other children do the same? Is POSIX, BSD sockets or any other standard defining it somewhere?
© Stack Overflow or respective owner