Re: gen_udp:recv()

zxq9 <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
On 2021/04/06 23:14, Łukasz Niemier wrote:
>> Anyway, in Erlang this is pretty much irrelevant. The common way to receive UDP traffic (and TCP traffic, for that matter) is to leave all the low level stuff to the runtime and inside your code just receive it as an Erlang message and not deal with udp:recv/2,3 at all.
> 
> Fortunately new `socket` module have `socket:recv/1` function that fetches all data that there are in the socket right now. So it should be perfectly possible to add `gen_udp:recv/1` that would receive whole packet at once. Also calling `gen_udp:recv(Socket, 1500)` should be safe enough as single UDP packet cannot be larger than MTU.

Indeed. However, I can't think of any cases where I would want to mess 
with that rather than receive packets as messages.

-Craig
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.