<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Vimal and Scott,  <div class=""><br class=""></div><div class="">I would like to clarify quickly that this is not a coincidence, and that I am processing ~500 messages/min over 1 socket connected to 1 client server and all of the messages are “framed” properly. There is <i class="">something</i> in the OTP that is framing the packets.<br class=""><div class=""><br class=""></div><div class="">Vimal - I am using {active, once}. And I like when it comes in as a full packet, so I do not want to change anything that could eliminate that behavior. When I get a handle info and ensure that the data is the right length in the guard, I can then do validation on the packet (we use a start code and stop code of 4 bytes) to ensure the validity of the packet from there. Having a stream and using gen_tcp:recv would complicate the gen_server in my opinion and it is clean now.</div><div class=""><br class=""></div><div class="">I just went to the Erlang man pages on the set_opts, and it seems like {active, once} works for my purposes:</div><div class=""><br class=""></div><div style="orphans: 2; widows: 2;" class="">"<span style="color: rgb(26, 26, 26); font-family: sans-serif; font-size: 16px; font-variant-ligatures: normal; background-color: rgb(254, 254, 254);" class="">If the value is </span><span class="code" style="font-family: mono, Courier, monospace; background-color: rgb(243, 243, 243); color: rgb(26, 26, 26); font-size: 16px; font-variant-ligatures: normal;">once</span><span style="color: rgb(26, 26, 26); font-family: sans-serif; font-size: 16px; font-variant-ligatures: normal; background-color: rgb(254, 254, 254);" class=""> (</span><span class="code" style="font-family: mono, Courier, monospace; background-color: rgb(243, 243, 243); color: rgb(26, 26, 26); font-size: 16px; font-variant-ligatures: normal;">{active, once}</span><span style="color: rgb(26, 26, 26); font-family: sans-serif; font-size: 16px; font-variant-ligatures: normal; background-color: rgb(254, 254, 254);" class="">), </span><strong style="color: rgb(26, 26, 26); font-family: sans-serif; font-size: 16px; font-variant-ligatures: normal; background-color: rgb(254, 254, 254);" class="">one</strong><span style="color: rgb(26, 26, 26); font-family: sans-serif; font-size: 16px; font-variant-ligatures: normal; background-color: rgb(254, 254, 254);" class="">data message from the socket is sent to the process…..</span></div><div style="orphans: 2; widows: 2;" class=""><span style="color: rgb(26, 26, 26); font-family: sans-serif; font-size: 16px; background-color: rgb(254, 254, 254);" class=""><br class=""></span></div><div style="orphans: 2; widows: 2;" class=""><span style="color: rgb(26, 26, 26); font-family: sans-serif; font-size: 16px; background-color: rgb(254, 254, 254);" class="">Use active mode only if your high-level protocol provides its own flow control (for example, acknowledging received messages) or the amount of data exchanged is small.</span><font color="#1a1a1a" face="sans-serif" size="3" class="">”</font></div><div class=""><span style="color: rgb(26, 26, 26); font-family: sans-serif; font-size: 16px; orphans: 2; widows: 2; background-color: rgb(254, 254, 254);" class=""><br class=""></span></div><div style="orphans: 2; widows: 2;" class=""><font color="#1a1a1a" face="sans-serif" class=""><span style="background-color: rgb(254, 254, 254);" class="">It does not define how long “one data message” is, but from reading on, it seems like the small size of my packets is the reason it is working. All of the packets I am expecting are < 500 bytes. </span></font></div><div style="orphans: 2; widows: 2;" class=""><font color="#1a1a1a" face="sans-serif" class=""><span style="background-color: rgb(254, 254, 254);" class=""><br class=""></span></font></div><div style="orphans: 2; widows: 2;" class=""><font color="#1a1a1a" face="sans-serif" class=""><span style="background-color: rgb(254, 254, 254);" class="">This settles this a bit for me, I can sleep at night, but we are working on an assumption about erlang’s “one data message</span>”.</font></div><div style="orphans: 2; widows: 2;" class=""><font color="#1a1a1a" face="sans-serif" class=""><br class=""></font></div><div style="orphans: 2; widows: 2;" class=""><font color="#1a1a1a" face="sans-serif" class="">If anyone can elaborate on this, or has some more in depth knowledge, I would greatly appreciate your expertise.</font></div><div class=""><br class=""></div><div class=""><div class=""><div><br class=""></div><br class=""></div></div></div></body></html>