Skip to content

Exomia.Network

Daniel Baetz edited this page Oct 1, 2020 · 28 revisions

ClientBase

A TCP/UDP-Client base.

public abstract class Exomia.Network.ClientBase
    : IClient, IDisposable

Constructors

.ctor ClientBase(Byte listenerCount = 1)

Summary:

Initializes a new instance of the class.

Parameter:

  • listenerCount - (Optional) The listener count.


Fields

    Socket _clientSocket
CompressionMode _compressionMode

Summary:

The compression mode.


    EncryptionMode _encryptionMode
    Byte _state

Properties

LingerOption LingerState

Summary:

Gets or sets the value of the connection's linger option.


    UInt16 MaxPayloadSize
Boolean NoDelay

Summary:

Enables or disables delay when send or receive buffers are full.


Int32 Port

Summary:

Gets the port.


Int32 ReceiveBufferSize

Summary:

Gets or sets the size of the receive buffer in bytes.


Int32 ReceiveTimeout

Summary:

Gets or sets the receive time out value of the connection in seconds.


Int32 SendBufferSize

Summary:

Gets or sets the size of the send buffer in bytes.


Int32 SendTimeout

Summary:

Gets or sets the send time out value of the connection in seconds.


String ServerAddress

Summary:

Gets the server address.



Events

CommandDataReceivedHandler DataReceived

Summary:

Occurs when data from a client is received.


DisconnectedHandler Disconnected

Summary:

called than the client is Disconnected.


Action Ping

Summary:

called than a ping is received.



Methods

void AddCommand(UInt16 commandID, DeserializePacketHandler deserialize)

Summary:

add a command deserializer.

Parameter:

  • commandID - Identifier for the command.
  • deserialize - The deserialize handler.

void AddCommand(UInt16[] commandIDs, DeserializePacketHandler deserialize)

Summary:

add commands deserializers.

Parameter:

  • commandIDs - The command ids.
  • deserialize - The deserialize handler.

void AddDataReceivedCallback(UInt16 commandID, DataReceivedHandler callback)

Summary:

add a data received callback.

Parameter:

  • commandID - Identifier for the command.
  • callback - The callback.

SendError BeginSend(PacketInfo& packetInfo)

Summary:

Begins send data.

Parameter:

  • packetInfo - Information describing the packet.

void Configure()

Summary:

Called after the
method directly after the socket is successfully created.


Boolean Connect(IPAddress[] ipAddresses, Int32 port, Action overwriteConfigure = null, Int32 timeout = 10)

Summary:

try's to connect the client to a server.

Parameter:

  • ipAddresses - The ip addresses.
  • port - The port.
  • overwriteConfigure - (Optional) Overwrite the default configuration.
  • timeout - (Optional) The timeout in seconds.

Boolean Connect(String serverAddress, Int32 port, Action overwriteConfigure = null, Int32 timeout = 10)

Summary:

try's to connect the client to a server.

Parameter:

  • serverAddress - The server address.
  • port - The port.
  • overwriteConfigure - (Optional) Overwrite the default configuration.
  • timeout - (Optional) The timeout in seconds.

    void DeserializeData(DeserializePacketInfo& deserializePacketInfo)
void Disconnect()

Summary:

call to disconnect from a server.


    void Disconnect(DisconnectReason reason)
    void Dispose()
void OnDispose(Boolean disposing)

Summary:

OnDispose.

Parameter:

  • disposing - disposing.

    void ReceiveAsync()
Boolean RemoveCommands(UInt16[] commandIDs)

Summary:

Removes the commands described by commandIDs.

Parameter:

  • commandIDs - A variable-length parameters list containing command ids.

void RemoveDataReceivedCallback(UInt16 commandID, DataReceivedHandler callback)

Summary:

remove a data received callback.

Parameter:

  • commandID - Identifier for the command.
  • callback - The callback.

SendError Send(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • isResponse - (Optional) True if this object is response.

SendError Send(UInt16 commandOrResponseID, Byte[] data, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

SendError Send(UInt16 commandOrResponseID, T& data, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

SendError Send(UInt16 commandOrResponseID, ISerializable serializable, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • isResponse - (Optional) True if this object is response.

SendError SendPing()

Summary:

send a ping command to the server.


Task> SendR(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, ISerializable serializable, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, ISerializable serializable, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, ISerializable serializable, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, ISerializable serializable, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, T& data, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, T& data, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, T& data, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, T& data, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendRPing()

Summary:

send a ping command to the server.


    Boolean TryCreateSocket(Socket& socket)

Static Fields

    Byte RECEIVE_FLAG
    Byte SEND_FLAG

CompressionMode

Values that represent CompressionMode.
MASK 0b00011000.

public enum Exomia.Network.CompressionMode
    : Enum, IComparable, IFormattable, IConvertible

Enum

0 None

Summary:

None


8 Lz4

Summary:

LZ4


16 Unused1

Summary:

Unused1


24 Unused2

Summary:

Unused2



DisconnectReason

Values that represent DisconnectReason.

public enum Exomia.Network.DisconnectReason
    : Enum, IComparable, IFormattable, IConvertible

Enum

0 Unspecified

Summary:

Unspecified/Unknown Reason


1 Graceful

Summary:

Graceful


2 Aborted

Summary:

Aborted


3 Error

Summary:

Error



EncryptionMode

Values that represent EncryptionMode.
MASK 0b00000111.

public enum Exomia.Network.EncryptionMode
    : Enum, IComparable, IFormattable, IConvertible

Enum

0 None

Summary:

None


4 End2End

Summary:

End2End



IClient

IClient interface.

public interface Exomia.Network.IClient
    : IDisposable

Methods

Boolean Connect(String serverAddress, Int32 port, Action overwriteConfigure = null, Int32 timeout = 10)

Summary:

try's to connect the client to a server.

Parameter:

  • serverAddress - The server address.
  • port - The port.
  • overwriteConfigure - (Optional) Overwrite the default configuration.
  • timeout - (Optional) The timeout in seconds.

Boolean Connect(IPAddress[] ipAddresses, Int32 port, Action overwriteConfigure = null, Int32 timeout = 10)

Summary:

try's to connect the client to a server.

Parameter:

  • ipAddresses - The ip addresses.
  • port - The port.
  • overwriteConfigure - (Optional) Overwrite the default configuration.
  • timeout - (Optional) The timeout in seconds.

void Disconnect()

Summary:

call to disconnect from a server.


SendError Send(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • isResponse - (Optional) True if this object is response.

SendError Send(UInt16 commandOrResponseID, Byte[] data, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

SendError Send(UInt16 commandOrResponseID, ISerializable serializable, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • isResponse - (Optional) True if this object is response.

SendError Send(UInt16 commandOrResponseID, T& data, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

SendError SendPing()

Summary:

send a ping command to the server.


Task> SendR(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, Byte[] data, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, ISerializable serializable, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, ISerializable serializable, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, ISerializable serializable, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, ISerializable serializable, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, T& data, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, T& data, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, T& data, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendR(UInt16 commandOrResponseID, T& data, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the server.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendRPing()

Summary:

send a ping command to the server.



IServer

Interface for server.

public interface Exomia.Network.IServer<TServerClient>
    : IDisposable

Methods

SendError SendTo(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length.
  • isResponse - (Optional) True if this object is response.

SendError SendTo(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

SendError SendTo(TServerClient client, UInt16 commandOrResponseID, ISerializable serializable, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • serializable - The serializable.
  • isResponse - (Optional) True if this object is response.

SendError SendTo(TServerClient client, UInt16 commandOrResponseID, T1& data, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

void SendToAll(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length)

Summary:

Sends data to all clients.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length.

void SendToAll(UInt16 commandOrResponseID, Byte[] data)

Summary:

Sends data to all clients.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.

void SendToAll(UInt16 commandOrResponseID, ISerializable serializable)

Summary:

Sends data to all clients.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • serializable - The serializable.

void SendToAll(UInt16 commandOrResponseID, T1& data)

Summary:

Sends data to all clients.

Parameter:

  • commandOrResponseID - Identifier for the command or response.
  • data - The data.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • offset - The offset.
  • length - The length of data.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, ISerializable serializable, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, ISerializable serializable, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, ISerializable serializable, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, ISerializable serializable, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • serializable - ISerializable.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, T& data, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, T& data, DeserializePacketHandler deserialize, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, T& data, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.

Task> SendToR(TServerClient client, UInt16 commandOrResponseID, T& data, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Summary:

send data to the client.

Parameter:

  • client - The client.
  • commandOrResponseID - Identifier for the command or response.
  • data - The data.
  • deserialize - The deserialize.
  • timeout - The timeout.
  • isResponse - (Optional) True if this object is response.


IServerClient

Interface for server client.

public interface Exomia.Network.IServerClient

Properties

IPAddress IPAddress

Summary:

Gets the IP address.


DateTime LastReceivedPacketTimeStamp

Summary:

Gets the Date/Time of the last received packet time stamp.



Packet

Packet readonly struct.

public struct Exomia.Network.Packet

Constructors

.ctor Packet(Byte[] buffer, Int32 offset, Int32 length)

Summary:

Initializes a new instance of the struct.

Parameter:

  • buffer - The buffer.
  • offset - The offset.
  • length - The length.


Fields

Byte[] Buffer

Summary:

The buffer.


Int32 Length

Summary:

The length.


Int32 Offset

Summary:

The offset.



Methods

    String ToString()
String ToString(Encoding encoding)

Summary:

Convert this packets raw data into a string representation.

Parameter:

  • encoding - The encoding.


Response

A response.

public struct Exomia.Network.Response<TResult>

Constructors

.ctor Response`1(TResult& result, UInt16 responseID, SendError sendError)

Summary:

Initializes a new instance of the struct.

Parameter:

  • result - The result.
  • responseID - The result.
  • sendError - The send error.


Fields

UInt16 ID

Summary:

The response id.

Remarks:

Specify this id instead of a command id in case you need to respond to a request.


TResult Result

Summary:

The result.


SendError SendError

Summary:

The send error.



SendError

Values that represent SendError.

public enum Exomia.Network.SendError
    : Enum, IComparable, IFormattable, IConvertible

Enum

0 None

Summary:

No error, all good


1 Socket

Summary:

A socket exception is occured


2 Disposed

Summary:

The socket was disposed


3 Invalid

Summary:

The SEND_FLAG is not set


4 Unknown

Summary:

Unknown error occured



ServerBase<T, TServerClient>

A server base.

public abstract class Exomia.Network.ServerBase<T, TServerClient>
    : IServer<TServerClient>, IDisposable

Constructors

.ctor ServerBase`2(Byte listenerCount = 1)

Summary:

Initializes a new instance of the class.

Parameter:

  • listenerCount - (Optional) The listener count.


Fields

Dictionary _clients

Summary:

The clients.


CompressionMode _compressionMode

Summary:

The compression mode.


    EncryptionMode _encryptionMode
    Socket _listener
    Int32 _port
    Byte _state

Properties

LingerOption LingerState

Summary:

Gets or sets the value of the connection's linger option.


    UInt16 MaxPayloadSize
Boolean NoDelay

Summary:

Enables or disables delay when send or receive buffers are full.


Int32 Port

Summary:

Gets the port.


Int32 ReceiveBufferSize

Summary:

Gets or sets the size of the receive buffer in bytes.


Int32 ReceiveTimeout

Summary:

Gets or sets the receive time out value of the connection in seconds.


Int32 SendBufferSize

Summary:

Gets or sets the size of the send buffer in bytes.


Int32 SendTimeout

Summary:

Gets or sets the send time out value of the connection in seconds.



Events

ClientActionHandler ClientConnected

Summary:

Called than a client is connected.


ClientCommandDataReceivedHandler ClientDataReceived

Summary:

Occurs when data from a client is received.


ClientDisconnectHandler ClientDisconnected

Summary:

Called than a client is disconnected.



Methods

void AddCommand(UInt16 commandID, DeserializePacketHandler deserialize)

Summary:

add a command deserializer.

Parameter:

  • commandID - Identifier for the command.
  • deserialize - The deserialize handler.

void AddCommand(UInt16[] commandIDs, DeserializePacketHandler deserialize)

Summary:

add commands deserializers.

Parameter:

  • commandIDs - The command ids.
  • deserialize - The deserialize handler.

void AddDataReceivedCallback(UInt16 commandID, ClientDataReceivedHandler callback)

Summary:

add a data received callback.

Parameter:

  • commandID - Identifier for the command.
  • callback - ClientDataReceivedHandler{Socket|Endpoint}

SendError BeginSendTo(T arg0, PacketInfo& packetInfo)

Summary:

Begins send data to.

Parameter:

  • arg0 - The argument 0.
  • packetInfo - Information describing the packet.

void Configure()

Summary:

Called after the method directly after the socket is successfully created.


Boolean CreateServerClient(TServerClient& serverClient)

Summary:

Create a new ServerClient than a client connects.

Parameter:

  • serverClient - [out] out new ServerClient.

void DeserializeData(T arg0, DeserializePacketInfo& deserializePacketInfo)

Summary:

Deserialize data.

Parameter:

  • arg0 - Socket|Endpoint.
  • deserializePacketInfo - Information describing the deserialize packet.

    void Dispose()
void InvokeClientDisconnect(T arg0, DisconnectReason reason)

Summary:

Executes the client disconnect on a different thread, and waits for the result.

Parameter:

  • arg0 - Socket|Endpoint.
  • reason - DisconnectReason.

void InvokeClientDisconnect(TServerClient client, DisconnectReason reason)

Summary:

Executes the client disconnect on a different thread, and waits for the result.

Parameter:

  • client - The client.
  • reason - DisconnectReason.

void ListenAsync()

Summary:

Listen asynchronous.


void OnAfterClientDisconnect(TServerClient client)

Summary:

called after .

Parameter:

  • client - The client.

void OnClientConnected(TServerClient client)

Summary:

Called than a new client is connected.

Parameter:

  • client - The client.

void OnClientDisconnected(TServerClient client, DisconnectReason reason)

Summary:

Called then the client is disconnected.

Parameter:

  • client - The client.
  • reason - DisconnectReason.

void OnDispose(Boolean disposing)

Summary:

OnDispose.

Parameter:

  • disposing - disposing.

Boolean OnRun(Int32 port, Socket& listener)

Summary:

Executes the run action.

Parameter:

  • port - The port.
  • listener - [out] The listener.

Boolean RemoveCommands(UInt16[] commandIDs)

Summary:

Removes the commands described by commandIDs.

Parameter:

  • commandIDs - A variable-length parameters list containing command ids.

void RemoveDataReceivedCallback(UInt16 commandID, ClientDataReceivedHandler callback)

Summary:

remove a data received callback.

Parameter:

  • commandID - Identifier for the command.
  • callback - ClientDataReceivedHandler{Socket|Endpoint}

Boolean Run(Int32 port, Action> overwriteConfigure = null)

Summary:

Runs.

Parameter:

  • port - The port.
  • overwriteConfigure - (Optional) Overwrite the default configuration.

    SendError SendTo(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, Boolean isResponse = False)
    SendError SendTo(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Boolean isResponse = False)
    SendError SendTo(TServerClient client, UInt16 commandOrResponseID, ISerializable serializable, Boolean isResponse = False)
    SendError SendTo(TServerClient client, UInt16 commandOrResponseID, T1& data, Boolean isResponse = False)
    void SendToAll(UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length)
    void SendToAll(UInt16 commandOrResponseID, Byte[] data)
    void SendToAll(UInt16 commandOrResponseID, T1& data)
    void SendToAll(UInt16 commandOrResponseID, ISerializable serializable)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, DeserializePacketHandler deserialize, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, DeserializePacketHandler deserialize, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, Int32 offset, Int32 length, TimeSpan timeout, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, TimeSpan timeout, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, Byte[] data, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, ISerializable serializable, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, ISerializable serializable, DeserializePacketHandler deserialize, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, ISerializable serializable, TimeSpan timeout, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, ISerializable serializable, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, TValue& data, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, TValue& data, DeserializePacketHandler deserialize, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, TValue& data, TimeSpan timeout, Boolean isResponse = False)
    Task> SendToR(TServerClient client, UInt16 commandOrResponseID, TValue& data, DeserializePacketHandler deserialize, TimeSpan timeout, Boolean isResponse = False)

Static Fields

    Int32 CLOSE_TIMEOUT
    Byte RECEIVE_FLAG
    Byte SEND_FLAG

ServerClientBase

A server client base.

public abstract class Exomia.Network.ServerClientBase<T>
    : IServerClient

Constructors

.ctor ServerClientBase`1()

Summary:

Initializes a new instance of the class.



Fields

    T _arg0

Properties

    T Arg0
IPAddress IPAddress

Summary:

Gets the IP address.


DateTime LastReceivedPacketTimeStamp

Summary:

Gets the Date/Time of the last received packet time stamp.



Methods

    void SetLastReceivedPacketTimeStamp()

Clone this wiki locally