question about "active" option (regarding gen_tcp)

Rick Pettit rpettit@REDACTED
Wed Nov 7 19:00:34 CET 2001


I have a concurrent TCP server which spawns a new process every time
gen_tcp:accept() returns.  I call gen_tcp:listen() and set active to
true, such that tcp packets arrive as messages in my mailbox.

I had hoped to call gen_tcp:controlling_process() immediately after my
call to accept, so that any TCP packets for that connection will be sent
to the spawned processes mailbox.

I fear that there is a race condition between the call to accept and the
call to controlling_process (which means the parent may receive TCP
packets in its mailbox instead of the child).

Any suggestions?

Rick




More information about the erlang-questions mailing list