989 B
989 B
Protocol
// Handshake or encryption setup here
- Client sends request for file
- Server answers with error or FileSize (possibly also Packetsize)
- Client ack
- Server sends File Packets with Sync to keep track
- Server sends Sync End Packet // LOOP
- If Packets were lost client sends request to resend specific Sync Packets
- Server sends Packets // LOOP END
- If Client has all packets, or retries has exceeded limit. Client sends Ack Packet for last Sync
- Client and Server "close" / forget the connection
Header
4 Byte Header Length | 4 Byte Request Flag (Request, Pte, Ack, File, End, Resend) | 4 Byte Sync | 4 Byte Data Length | x Byte Data
Data
Request Data = UTF-8 File Path / File Lookup
Packets to expect (PTE) = uint32 little endian Number of Packets to expect
Ack = uint32 little endian Sync number to Acknowledge
File = Raw file bytes
End = uint32 little endian Sync number of last File Packet
Resend = uint32 little endian Sync number to Resend