data method

DirectPacket data(
  1. Uint8List payload, {
  2. required int sn,
  3. int index = 0,
  4. int count = 1,
})

Ordinary data packet (peer -> peer).

payload is the message body. sn is the data serial number. index is the fragment offset within the transfer. count is the total number of fragments.

command stays 0 (C=0) to keep the header small.

Returns a DATA packet.

Implementation

DirectPacket data(Uint8List payload, {
  required int sn,
  int index = 0,
  int count = 1,
}) => DirectPacket.create(
  ack: 0,
  sn: sn,
  index: index,
  count: count,
  command: Command.EMPTY,  // 0
  payload: payload,
);