[erlang-questions] Low Level Socket Example

Sargun Dhillon <>
Thu Aug 14 10:31:00 CEST 2008


It would be pretty neat if you could get a working implementation of
usermode sockets in Erlang that used Mnesia as a state machine
database. That way you use the same socket on two different BEAM
instances after a failover. Would you like to post some of your
research, or information here?

On Tue, Aug 12, 2008 at 9:54 PM, David Mitchell <> wrote:
> If you want a very powerful network toolkit that can do just about
> anything conceivable, check out Scapy
> (http://www.secdev.org/projects/scapy/).
>
> It's Python, not Erlang, but I doubt that a more
> capable/extensible/powerful network toolkit exists short of getting
> into e.g. Linux kernel code and tweaking it.
>
> Regards
>
> Dave M.
>
> 2008/8/13 Serge Aleynikov <>:
>> If you are interested in learning the details of network protocols,
>> Erlang could be your friend for the task as a rapid prototyping
>> framework.  You have to be aware though that a TCP stack in Erlang will
>> not deliver the same performance as the kernel-level stack
>> implementation.  However it is doable as a proof of concept.
>>
>> The network driver that comes with Erlang is not suited for this task,
>> as it serves as a bridge between TCP/SCTP/UDP protocols and the
>> emulator.  So if you really have interest in accessing raw sockets,
>> you'd need to write a driver in C/C++  to marshal raw packets between
>> user-level POSIX API and an Erlang process.
>>
>> Serge
>>
>> Marc Eisenbarth wrote:
>>>> Why can't you use gen_tcp? Do you really need to implement OS level APIs
>>>> in
>>>> Erlang? Erlang really isn't the right language for raw socket
>>>> manipulation.
>>>> Try out C.
>>>
>>> gen_tcp will do the entire TCP session setup for me, so it's not appropriate for my task. Just because C might be better for this task, doesn't mean it's better for the rest of my program. In fact, there's are at least 2 examples of projects that implement network stacks in Erlang, so at least a few people out there that would disagree with you and instead agree that there is some merit in using Erlang :)
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list