JHUISI / charm

Charm: A Framework for Rapidly Prototyping Cryptosystems
http://charm-crypto.io
GNU Lesser General Public License v3.0
552 stars 167 forks source link

Protocol: robust messaging #206

Closed EDVTAZ closed 5 years ago

EDVTAZ commented 5 years ago

Prepend messages with their length before sending them, this way we can receive them correctly, even if they get fragmented.

Signed-off-by: Gabor Szekely szvgabor@gmail.com

EDVTAZ commented 5 years ago

Hi, when sending long messages, sometimes not all of the message arrived. As far as I can tell, this is due to TCP packet fragmentation (https://stackoverflow.com/questions/756765/when-will-a-tcp-network-packet-be-fragmented-at-the-application-layer). One way of fixing this is prepending the message with it's length, and then receiving exactly that much bytes.