[erlang-questions] inet / active once

Joost Yervante Damad joost.damad@REDACTED
Fri Nov 17 08:39:43 CET 2006


On Friday 17 November 2006 01:45, Per Hedeland wrote:
> I'd agree with Klacke, don't touch inet_drv until you're sure that you
> need to.:-) Also, read carefully the documentation for gen_tcp:recv() to
> see how the semantics differ from Unix/Posix recv()/read(), which makes
> it much more convenient to "implement" the framing in Erlang. I.e. you
> recv() as many bytes as you need to find the length of the message, then
> recv() that many bytes - you never get less than you asked for, and
> inet_drv and the I/O system handles the buffering and
> (non-)blocking/polling for you.

Oh! I overlooked that. This simplifies things alot indeed! I guess I'll throw 
away my current overly complex framing code, and use recv/2.

Thanks, Joost



More information about the erlang-questions mailing list