Hi Steve,
One of the main benefits of TCP (Transmission Control Protocol) is its reliability. TCP ensures that data is completely received and sent, using mechanisms like acknowledgment packets, sequence numbers, and retransmissions to guarantee delivery. It’s essentially a “set it and forget it” protocol in terms of data delivery, as it handles these checks internally.
BUT, developers need to pay attention in the segmentation and reassembly of data (ensuring that larger chunks of data are properly broken up for transmission and then reassembled correctly on the receiving end). So while TCP handles many aspects of reliability, there's still some responsibility on the developer to manage data correctly, especially if dealing with larger messages or streams of data.
You can use a terminal character, or start a message by its length (use a Buffer object with pack method for that) so that when using Socket:recv() you know you have to continue to recv() until the specified amount of bytes have been received.
ps: thank you, don't hesitate to post any feedback on LuaRT 1.9.0