requestFileData (11)
The requestFileData message is sent by the file recipient to the sender to request a specific portion (a "chunk" or "packet") of the file. This pull-based mechanism allows the receiver to manage the download rate and re-request missing chunks.
Core Data Types
string: A standard UTF-8 encoded string.uint64: A 64-bit unsigned integer, serialized in Little-Endian format.
Payload Structure
| Field | Data Type | Min | Max | Description |
|---|---|---|---|---|
uid | string | * | * | The unique identifier of the file transfer session. |
packetNumber | uint64 | 0 | * | The sequential index of the file chunk being requested (starting from 0). |
Behavioral Notes
- Receiver-Driven: The file download is driven by the receiver. After sending
acceptFile, the receiver's client begins sending a series ofrequestFileDatamessages, typically in sequential order, until all chunks have been requested. - Sender Response: When the sender's client receives a
requestFileDatamessage, it must read the corresponding chunk of data from the source file and send it back to the recipient in afileDatamessage. - Retries: If a
fileDatamessage for a specific chunk is not received within a timeout period, the recipient can resend therequestFileDatamessage for that samepacketNumber.