Blocking/Non-Blocking Sockets ???

chandru chandrashekhar.mullaparthi@REDACTED
Wed Sep 14 09:06:38 CEST 2005


Look at the {active, Boolean} option on sockets. You can change this
option on a socket using the inet:setopts/2 function and inspect
values using the inet:getopts/2 function.

56> {ok, Sock} = gen_tcp:connect("localhost", 22301, [{active, true}]).
57> inet:getopts(Sock, [active]).         

When you set the {active, true} option on a connected socket, all data
which is received on that socket will be sent to your process as
messages of the form {tcp, Socket, Data}


On 14/09/05, vipin <vipin@REDACTED> wrote:
> Hello all,
> How to figure out whether a socket is blocking or non-blocking ???
> And if it is a blocking one, then how can i transform it into a
> non-blocking type ?
> Your suggestions would be welcome.
> Cheers,
> Vipin

More information about the erlang-questions mailing list