Bitfield

data class Bitfield(val bitfield: Bitfield) : PeerMessage

bitfield (id 5): the complete set of pieces the sender has. The payload is the bitfield's raw bytes (MSB-first, exactly Bitfield.data()).

Constructors

Link copied to clipboard
constructor(bitfield: Bitfield)

Properties

Link copied to clipboard
Link copied to clipboard
open override val id: Int

The numeric message id, or -1 for KeepAlive (which has no id byte on the wire). Matches bt_peer_connection::message_type.

Functions

Link copied to clipboard
open override fun encode(): ByteArray

The full on-the-wire frame: 4-byte big-endian length prefix + id + payload.