R-Type 0.1
Loading...
Searching...
No Matches
PingMessage Struct Reference

Payload of a Ping message, 4 bytes, sent by a client to measure latency. More...

#include <protocol/PingMessage.hpp>

Public Member Functions

bool serialize (PacketWriter &writer) const
 Writes the payload in network byte order.
 
bool deserialize (PacketReader &reader)
 Reads the payload from a buffer.
 

Public Attributes

std::uint32_t timestamp = 0
 Sender defined time value.
 

Static Public Attributes

static constexpr std::size_t SIZE = 4
 Encoded size of the payload, in bytes.
 

Detailed Description

Payload of a Ping message, 4 bytes, sent by a client to measure latency.

Offset Size Field Description
0 4 timestamp Opaque value echoed back in a Pong.

Member Function Documentation

◆ serialize()

bool PingMessage::serialize ( PacketWriter & writer) const

Writes the payload in network byte order.

Parameters
writerDestination buffer.
Returns
True on success, false if the buffer is full.

◆ deserialize()

bool PingMessage::deserialize ( PacketReader & reader)

Reads the payload from a buffer.

Parameters
readerSource buffer.
Returns
True on success, false if fewer than 4 bytes remain.