<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">On Mon, Apr 5, 2021 at 4:21 PM Avinash Dhumane <<a href="mailto:trigunatit@gmail.com">trigunatit@gmail.com</a>> wrote:</span><br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-IN" style="overflow-wrap: break-word;"><div class="gmail-m_5931033941544497313WordSection1"><p class="MsoNormal"><span style="font-size:14pt">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().</span><br></p><p class="MsoNormal"><span class="gmail-m_5931033941544497313DefaultFontHxMailStyle"><span style="font-size:14pt"><u></u></span></span></p></div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">It's due to being there in low level socket handling (in C). You need to specify the size of the buffer to write the result into. It matters somewhat. While Ethernet normally specifies a limit of 1500 bytes (minus header, minus tagging, ...), a local loopback interface can easily be 16k, 64k, or more. And if you are considering a high count of receivers, it might be wise to limit the maximal size you are willing to receive.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">As for the overhead: if you have many small messages and need to have a high processing rate, I'm going to suggest you either try {active, N} or go the route Max laid out by moving the processing loop into C to get it fast enough. You can work backwards: 100k messages per second means you have to process messages at a rate of one per 10 microseconds. At those rates, it isn't uncommon you need some kind of microbatching to keep up.</div><br></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature">J.</div></div>