Table of Contents

Interface IGameNetworkPacket

Namespace
Moongate.Network.Packets.Interfaces
Assembly
Moongate.Network.Packets.dll

Defines the contract for parsing and writing a game network packet.

public interface IGameNetworkPacket

Properties

Length

Gets the packet length. Use -1 for variable-length packets.

int Length { get; }

Property Value

int

OpCode

Gets the packet opcode identifier.

byte OpCode { get; }

Property Value

byte

Methods

TryParse(ReadOnlySpan<byte>)

Attempts to parse packet data from the given input span.

bool TryParse(ReadOnlySpan<byte> data)

Parameters

data ReadOnlySpan<byte>

Raw packet bytes.

Returns

bool

true when parsing succeeds; otherwise false.

Write(ref SpanWriter)

Writes packet bytes to the target span writer.

void Write(ref SpanWriter writer)

Parameters

writer SpanWriter

Destination writer.