Skip to the content.

Server

Namespace: DataFlow

Provides functionality for managing a server.

public class Server

Inheritance ObjectServer

Constructors

Server(UInt16)

Initializes a new server using the provided port.

public Server(ushort port)

Parameters

port UInt16
The port number.

Methods

Start()

Begins accepting incoming connections.

public void Start()

Shutdown()

Shuts down the server disconnecting all connected clients.

public void Shutdown()

Disconnect(Guid)

Disconnects a connected client using their provided GUID.

public void Disconnect(Guid guid)

Parameters

guid Guid
The client GUID.

Send(Guid, Packet)

Sends a packet to a connected client.

public Task Send(Guid guid, Packet packet)

Parameters

guid Guid
The client GUID.

packet Packet
The packet to be sent.

Returns

Task

Broadcast(Guid, Packet)

Sends a packet to all connected clients except the one provided.

public Task Broadcast(Guid guid, Packet packet)

Parameters

guid Guid
The exception client GUID.

packet Packet
The packet to be sent.

Returns

Task

Events

Connected

Invoked when a client gets connected.

public event EventHandler<Guid> Connected;

Disconnected

Invoked when a client gets disconnected.

public event EventHandler<Guid> Disconnected;

PacketReceived

Invoked when a packet is received.

public event EventHandler<PacketEventArgs> PacketReceived;