gen_tcp:controlling_process

Sean Hinde Sean.Hinde@REDACTED
Fri Feb 28 13:15:35 CET 2003


> As Martin says "use with care" it is worth pointing out 
> another way of doing
> this:
> 
> Have a process which owns the listening socket. This will 
> spawn a socket
> process which will block in accept until a client arrives - 
> at which time it
> messages back to the listening process to tell it to spawn a new
> socket/accepting process.
> 
> This model is widely used but for a very nice example take a 
> look at joe's
> recent web_server tutorial. http://www.sics.se/~joe

Now I just read Chris' post pointing out Joe's comment that this is very
complex.. If you study Joes code (always an education) you will eventually
see why, but if you don't need to limit the number of connections then my
recipe will work OK (you of course do need to handle EXIT messages from the
accepting process, which may arrive before or after the accept succeeded)

Sean



 NOTICE AND DISCLAIMER:
This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.




More information about the erlang-questions mailing list