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

Papa Tana <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAGoraXTFOq1RW-1qxTn0ZUF9oVjooMeifuG3mxUsrqtXcNcPxA@mail.gmail.com>
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 <[email protected]> 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
> [email protected]
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.