Network protocol - how to detect message termination

Jakub Kubiak jakub.k.kubiak at student.put.poznan.pl
Wed Aug 16 23:40:29 UTC 2017


Hi,

Currently I'm developing an rsync packet sniffer and I'm trying to understand the basics of the network protocol.
I had a hard time analyzing the source code and couldn't find the answers to the 2 main issues I have:

1. How do I detect the end of the file list message(s) sent by the sender?
2. How do I detect the end of the checksums message(s) sent by the receiver?

According to the https://rsync.samba.org/how-rsync-works.html "when the sender is sending the file list it simply
sends each file list entry and terminates the list with a null byte. Within the file list entries, a bitfield
indicates which fields of the structure to expect and those that are variable length strings are simply null terminated.
The generator sending file numbers and block checksum sets works the same way", but I don't find this statement to be true.

For the sake of simplicity please consider daemon-mode connection with no additional options.

Kind regards,
Jakub



More information about the rsync mailing list