Table of Contents

Interface IListenSocket

Namespace
BSGameLib.Server
Assembly
BSGameLib.Server.dll

The server's connections to its clients, and the sends and disconnects that go to them.

public interface IListenSocket
Extension Methods

Properties

AllConnections

A snapshot of the open connections.

IReadOnlyCollection<INetConnection> AllConnections { get; }

Property Value

IReadOnlyCollection<INetConnection>

IsListening

Whether the socket is listening for clients.

bool IsListening { get; }

Property Value

bool

Methods

Disconnect(INetConnection, string)

Closes the connection. message is sent to the client as its reason; null is sent as an empty reason.

void Disconnect(INetConnection connection, string message = null)

Parameters

connection INetConnection
message string

DisconnectWith<T>(INetConnection, T, string)

Sends a final packet, waits for it to reach the wire, then disconnects. Use this whenever the peer needs to know why it was disconnected -- a plain SendReliableTo<T>(INetConnection, T) followed by Disconnect(INetConnection, string) races the close and normally loses.

void DisconnectWith<T>(INetConnection connection, T packet, string message = null) where T : IDataPacket

Parameters

connection INetConnection
packet T
message string

Type Parameters

T

SendReliableToAllBut<T>(INetConnection, T)

Sends packet reliably to every connection except connection.

void SendReliableToAllBut<T>(INetConnection connection, T packet) where T : IDataPacket

Parameters

connection INetConnection
packet T

Type Parameters

T

SendReliableToAll<T>(T)

Sends packet reliably to every connection.

void SendReliableToAll<T>(T packet) where T : IDataPacket

Parameters

packet T

Type Parameters

T

SendReliableTo<T>(INetConnection, T)

Sends packet to connection reliably and in order.

void SendReliableTo<T>(INetConnection connection, T packet) where T : IDataPacket

Parameters

connection INetConnection
packet T

Type Parameters

T

SendUnreliableSequencedToAllBut<T>(INetConnection, T)

Sends packet without delivery guarantees to every connection except connection.

void SendUnreliableSequencedToAllBut<T>(INetConnection connection, T packet) where T : IDataPacket

Parameters

connection INetConnection
packet T

Type Parameters

T

SendUnreliableSequencedToAll<T>(T)

Sends packet to every connection without delivery guarantees.

void SendUnreliableSequencedToAll<T>(T packet) where T : IDataPacket

Parameters

packet T

Type Parameters

T

SendUnreliableSequencedTo<T>(INetConnection, T)

Sends packet to connection without delivery guarantees. A packet that arrives after a newer one is dropped.

void SendUnreliableSequencedTo<T>(INetConnection connection, T packet) where T : IDataPacket

Parameters

connection INetConnection
packet T

Type Parameters

T

SendUnreliableToAllBut<T>(INetConnection, T)

Sends packet without delivery or order guarantees to every connection except connection.

void SendUnreliableToAllBut<T>(INetConnection connection, T packet) where T : IDataPacket

Parameters

connection INetConnection
packet T

Type Parameters

T

SendUnreliableToAll<T>(T)

Sends packet without delivery or order guarantees to every connection.

void SendUnreliableToAll<T>(T packet) where T : IDataPacket

Parameters

packet T

Type Parameters

T

SendUnreliableTo<T>(INetConnection, T)

Sends packet to connection without delivery or order guarantees.

void SendUnreliableTo<T>(INetConnection connection, T packet) where T : IDataPacket

Parameters

connection INetConnection
packet T

Type Parameters

T

StartListening()

Starts listening for clients.

void StartListening()

StopListening()

Disconnects every client with a shutdown message, then stops listening.

void StopListening()