<div dir="ltr"><div>You may look at epgsql's packet parser as an example. It has packet-type + packet-length - prefixed packet structure and it doesn't use {packet, N} option.</div><div><br></div><div>handle_info({_, Sock, Data2}, ...)</div><div><a href="https://github.com/epgsql/epgsql/blob/3.2.0/src/epgsql_sock.erl#L152">https://github.com/epgsql/epgsql/blob/3.2.0/src/epgsql_sock.erl#L152</a><br></div><div><br></div><div>tail buffering</div><div><a href="https://github.com/epgsql/epgsql/blob/3.2.0/src/epgsql_sock.erl#L359">https://github.com/epgsql/epgsql/blob/3.2.0/src/epgsql_sock.erl#L359</a><br></div><div><br></div><div>here we check packet bounds</div><div><a href="https://github.com/epgsql/epgsql/blob/3.2.0/src/epgsql_wire.erl#L22">https://github.com/epgsql/epgsql/blob/3.2.0/src/epgsql_wire.erl#L22</a><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Stanislaw,<br>Is there a common solution to this problem? Erlang was built to be used in servers/switches, i would assume that there was a solution built into OTP?<br>If not, do you handle it just at the application later with gen_tcp:recv() and read X bytes at a time from the socket based on delimiters and such? How would you reconcile this with using a gen_server implementation that receives messages from the ssl socket in handle info ?<br>I appreciate the help, I?m happy I didn?t roll this further</blockquote></div>