How to read all traffic received on one network interface using Erlang

Papa Tana papa.tana101@REDACTED
Thu Aug 13 09:47:56 CEST 2020


Hi,

I correct my previous post, sorry, regarding {error, eisdir}

I'm on OTP/19.

>From OTP/22:
  OTP-11462    Application(s): erts
               It is now possible to open device files and FIFOs with
               file:open/2.

My bad!

Thanks
Best Regards,

Le jeu. 13 août 2020 à 10:29, Papa Tana <papa.tana101@REDACTED> a écrit :

> Ok, then it's kind of a device file, and of course it is, so stupid from
> me, because my VM can boot and attach to it :-/
>
> trying traditional way gives me {error,eisdir}:
>
> > file:open
> > file:read_file
>
> As a perfect workaround, as long as open_port is working (I'm using
> OTP/19), I will keep it:
> http://erlang.org/download/otp_src_19.0.readme
>
>
>
> *But I don't know for the latest OTP/23 and for the future OTP release,
> because I see a lot of assert that it will be removed?Can one confirm that
> please?*
> Best Regards,
>
> Le mer. 12 août 2020 à 22:41, Łukasz Niemier <lukasz@REDACTED> a écrit :
>
>> > 3/ Anyway, I hope I did not misunderstood, but I was undesrtanding that
>> it was feasible to connect to an existing named pipe "allocated by mkfifo"
>> via gen_udp/gen_tcp?
>> > because for this, I always fail, since the named pipe has the same name
>> as my unix-domain socket.
>> >
>> > {error, eaddrinuse} when listen , {error, econnrefused} when send
>> >
>> > ==> So my question is, How do you connect to an existing named pipe
>> allocated by mkfifo, via gen_udp/gen_tcp, not using open_port?
>>
>> You treat named pipe as a **file** not socket. So you would use "regular"
>> file and io functions for opening and reading content of file.
>>
>> > PS: I will try to understand socat and cap_net_raw as well later on :-p
>>
>> Socat is just a utility to pipe data to/from the sockets and cap_net_raw
>> is needed when you do not want to run VM (or ports) as root.
>>
>> --
>>
>> Łukasz Niemier
>> lukasz@REDACTED
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200813/4c7b5580/attachment.htm>


More information about the erlang-questions mailing list