<div dir="ltr">Hi,<div><br></div><div>I believe you are using with the inet:setopts/2 'active' option set to true? Set it to false or once and then use gen_tcp:recv/2,3 to read from tcp stream upto the length you want. </div><div><br></div><div><a href="http://erlang.org/doc/man/inet.html#setopts-2">http://erlang.org/doc/man/inet.html#setopts-2</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 31, 2017 at 8:11 PM, code wiget <span dir="ltr"><<a href="mailto:codewiget95@gmail.com" target="_blank">codewiget95@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
>From my understanding, tcp is a stream based protocol, and you can’t really tell one packet from another. You can make sure the packets arrive in order, but whether or not they should be â€œgrouped” is not seen by the application layer.<br>
<br>
But somehow Erlang ssl and tcp abstract this away.<br>
<br>
In my code, I have some sort of the following:<br>
<br>
Handle_info({tcp/ssl, Sock, Data}, State) -> â€¦ and every time that I receive data into the socket, it comes as the â€œfull package”, meaning that when another server sends a message to it over the socket, It is received as the full length of the packet every time with no extra bytes here or there. On the other hand, a co-worker’s server has to implement socket reads and can’t determine one â€œgroup” from another. They have to read in the length or set delimiters.<br>
<br>
<br>
What is special about OTP that delimits these packets?<br>
______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
</blockquote></div><br></div>