gen_udp:recv()
Avinash Dhumane <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <[email protected]> |
Hello!
I am taking a short-cut to inquire this, by posting to you all (than going through relevant documentation).
Is gen_udp:recv() to be invoked per datagram, or can it return a binary of multiple datagrams concatenated?
I am asking this because there is Length to recv(), and I don’t understand why it is there. Should it specify the length of expected datagram? What if the datagrams of variable length? Should it, then, specify the maximum length?
The default receive buffer size is 8K bytes. If Length argument to recv() is specified to this value, will it still return one datagram or multiple?
In contrast, in gen_tcp:recv(), the Length argument could be specified to zero, in which case, all the arrived bytes are returned as the binary (as per documentation). Does gen_udp:recv() do similar – return all the datagrams arrived (if Length is specified to be zero)?
My need for the socket is {active, false}. I had tried with {active, true} in the past, and got the datagrams as individual messages in the inbox of my process. So, I assume that there will be one call to recv() per datagram. I do not have the setup to test {active, false}; hence, I am not sure about the behaviour of (and, rationale for) Length argument to recv().
Please!
Thanks
Avinash