gen_tcp:controlling_process

martin j logan martin@REDACTED
Thu Feb 27 19:20:14 CET 2003


Jay,
    gen_tcp accepts the option {active, true}. The purpose of this
option is to allow the receipt of incoming tcp packets as messages to be
delivered to a specific processes mailbox. One would need to use the
controlling_process function in order to direct incoming packets to an
alternate mailbox. If you look at the code for gen_tcp it seems the
obvious race conditions have been handled but I would use it with care.

Cheers,
Martin

On Thu, 2003-02-27 at 01:33, Jay Nelson wrote:
> When is gen_tcp:controlling_process necessary?
> 
> I have a function that is blocking on an accept call
> waiting for a Socket connection.  When it gets one,
> it spawns a new process, passes the Socket, and
> then starts accept again.  The new process is able
> to read the Socket without having been given access
> by gen_tcp:controlling_process.  Is that normal?
> 
> I am running on RedHat 7.3 x86 architecture.
> 
> jay





More information about the erlang-questions mailing list