[erlang-questions] How does Erlang TCP determine the end of a TCP stream?
code wiget
codewiget95@REDACTED
Tue Oct 31 15:41:26 CET 2017
Hello,
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.
But somehow Erlang ssl and tcp abstract this away.
In my code, I have some sort of the following:
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.
What is special about OTP that delimits these packets?
More information about the erlang-questions
mailing list