Table of Contents

Class Vcmp

Namespace
OpenGSQ.Protocols
Assembly
OpenGSQ.dll

Vice City Multiplayer Protocol

public class Vcmp : ProtocolBase
Inheritance
Vcmp
Derived
Inherited Members

Constructors

Vcmp(string, int, int)

Initializes a new instance of the Vcmp class.

public Vcmp(string host, int port, int timeout = 5000)

Parameters

host string

The host address of the server.

port int

The port number of the server.

timeout int

The timeout for the connection in milliseconds.

Fields

RequestHeader

The request header to be sent to the remote host.

protected byte[] RequestHeader

Field Value

byte[]

ResponseHeader

The expected response header from the remote host.

protected byte[] ResponseHeader

Field Value

byte[]

Properties

FullName

Gets the full name of the protocol.

public override string FullName { get; }

Property Value

string

Methods

GetPlayers()

Asynchronously gets the list of players from the server.

public Task<List<Player>> GetPlayers()

Returns

Task<List<Player>>

A task that represents the asynchronous operation. The task result contains a list of Player objects.

Exceptions

TimeoutException

Thrown when the operation times out.

GetResponse(byte)

Sends data to a remote host and receives a response.

protected Task<byte[]> GetResponse(byte data)

Parameters

data byte

The data to be sent.

Returns

Task<byte[]>

A byte array containing the response from the remote host.

Exceptions

TimeoutException

Thrown when the operation times out.

GetStatus()

Asynchronously gets the status of the server.

public Task<Status> GetStatus()

Returns

Task<Status>

A task that represents the asynchronous operation. The task result contains a StatusResponse object with the server status.

Exceptions

TimeoutException

Thrown when the operation times out.

ReadString(BinaryReader, int)

Reads a string from a binary reader.

protected static string ReadString(BinaryReader br, int readOffset = 1)

Parameters

br BinaryReader

The binary reader.

readOffset int

The read offset. Default is 1.

Returns

string

The string read from the binary reader.