Skip to the content.

Client

Namespace: DataFlow

Provides functionality for managing a client.

public class Client

Inheritance ObjectClient

Constructors

Client(String, UInt16)

Initializes a new client using the provided IP address and port.

public Client(string ipAddress, ushort port)

Parameters

ipAddress String
The server IP address.

port UInt16
The port number.

Methods

Connect()

Connects the client.

public void Connect()

Disconnect()

Disconnects the client.

public void Disconnect()

Send(Packet)

Sends a packet to the server.

public Task Send(Packet packet)

Parameters

packet Packet
The packet to be sent.

Returns

Task

Events

Connected

Invoked when the client gets connected.

public event EventHandler Connected;

Disconnected

Invoked when the client gets disconnected.

public event EventHandler Disconnected;

ConnectionRefused

Invoked when the client is actively refused connection.

public event EventHandler ConnectionRefused;

PacketReceived

Invoked when the client receives a packet.

public event EventHandler<Packet> PacketReceived;