Dealing with a TCP packet with a little endian header in Erlang gen_tcp
Posted by Jim Morris on Mon Apr 13 01:11:57 -0700 2009
In Erlang they have a very neat way of reading TCP packets that have a header that specifies how big the following packet is. So long as you send that header as a big-endian integer, you can use the built-in mechanism. Then gen_tcp, takes care of making sure the entire packet is read before passing it onto you.
Here is an example of a simple server getting packets from a client using some simple binary protocol... For instance sending this binary packet,
... Show more ...