[erlang-questions] inet / active once

Claes Wikstrom klacke@REDACTED
Thu Nov 16 09:26:31 CET 2006


Joost Yervante Damad wrote:
> Hi,
> 
> recently I've been playing with the erlang programming language, and I like 
> it. I wrote a few test servers, and I especially like the inet active once 
> mechanism for having automatically framed messages, even over a TCP 
> connection, in combination with the {packet, PacketType} option.
> 
> Yesterday, I wanted to try something more heavy and implement a simple 
> DIAMETER stack, however it's header format does not match any of the existing 
> packet types available, because it has a header like this:
> 
>  byte1: version
>  byte2-4: packet length
> 
> I did some digging in the OTP code and it seems the packet types are 
> implemented in inet_drv.c.
> 
> I see now two possibilities, either I expand inet_drv.c to have a new package 
> type, or I use {active, false}, and implemented the message framing in 
> erlang.
> 
> Is there another possibilty? What is the recommended aproach?


I'd recommend to first implement the whole thing without touching inet_drv.c
Later - if you want to go ahead with the diameter impl. and use it
in production and you _also_ have performance issues - then attack the
inet_drv.c code.

Several reasons

1. easy to get it wrong in inet_drv.c
2. You'll be in the air faster if you don't touch inet_drv.c
3. OTP crew may not want your inet_drv.c fixes


/klacke



More information about the erlang-questions mailing list