class MCPing::Request

Overview

The request class is used internally by both the ping and query functions.

It likely does not have anything terribly interesting for external use.

Defined in:

mcping/request.cr

Constant Summary

PROTOCOL_VERSION = 71_u8

Instance Method Summary

Instance Method Detail

def createHandshake(host : String, port : UInt32) #

Creates a handshake packet.

Requires the server host and port for creating a correct packet.


[View source]
def createPacket(pl : Bytes) #

Finalizes a packet to be sent.

It adds the size of the bytes as a uvarint to the beginning then appends the provided bytes.


[View source]
def createStatusRequest #

Makes the packet for a status request. It's a very simple packet.


[View source]
def readStatus(conn : TCPSocket) #

Reads the ping response data from the socket.


[View source]
def readVarInt(conn : TCPSocket) #

Reads a varint from a TCPSocket.


[View source]
def readVarInt(by : Array(UInt8)) #

Reads a varint from an UInt8 Array.


[View source]