zxq9 zxq9@REDACTED
Tue Apr 6 16:16:51 CEST 2021

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.


More information about the erlang-questions mailing list