Active and Passive Sockets
Erlang sockets can be opened in one of three modes:
active, active once, or
passive. This is done by including an
option {active, true | false | once}
in the Options
argument to either gen_tcp:connect(Address, Port,
Options
or gen_tcp:listen(Port, Options)
.
If {active, true}
is specified, then an active socket
will be created; {active, false}
specifies a passive
socket. {active, once}
creates a socket that is active
but only for the reception of one message; after it has received
this message, it must be reenabled before it can receive the
next message.
We’ll go through how these different types of sockets are used in the following sections.
The difference between active and passive sockets has to do with what ...
Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.