Blocking/Non-Blocking Sockets ???

Bengt Kleberg bengt.kleberg@REDACTED
Wed Sep 14 08:51:00 CEST 2005


On 2005-09-14 08:23, vipin wrote:
> Hello all,
> 
> How to figure out whether a socket is blocking or non-blocking ???

i presume that you mean the socket created by gen_udp:open() (or 
gen_tcp:open()). if you mean the operating systems sockets, they are 
non-blocking (and will so remain since the whole erlang node otherwoise 
would stop when any one process read from a blocking socket).


> And if it is a blocking one, then how can i transform it into a 
> non-blocking type ?

according to the documentation (gen_udp, gen_tcp and inet) a socket is 
active (sort of non-blocking) by default. it is possible to set it to 
non active when you open it. it is also possible to have it active once.


bengt



More information about the erlang-questions mailing list