Skip to content

Exomia.Network

Daniel Baetz edited this page Jul 7, 2018 · 28 revisions

ClientApm

A TCP/UDP-Client build with the "Asynchronous Programming Model" (APM)

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

ClientBase

A TCP/UDP-Client base

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

Properties

Type Name Summary
Int32 Port Port
String ServerAddress ServerAddress

Events

Type Name Summary
DisconnectedHandler Disconnected called than the client is Disconnected
Action<PING_STRUCT> Ping called than a ping is received

Methods

Type Name Summary
void AddCommand(UInt32 commandid, DeserializePacket<Object> deserialize) add a command
void AddDataReceivedCallback(UInt32 commandid, DataReceivedHandler callback) add a data received callback
Boolean Connect(SocketMode mode, IPAddress[] ipAddresses, Int32 port, Int32 timeout = 10)
Boolean Connect(SocketMode mode, String serverAddress, Int32 port, Int32 timeout = 10)
void Disconnect()
void Dispose()
void RemoveCommand(UInt32 commandid) remove a command
void RemoveDataReceivedCallback(UInt32 commandid, DataReceivedHandler callback) remove a data received callback
SendError Send(UInt32 commandid, Byte[] data, Int32 offset, Int32 length)
SendError Send(UInt32 commandid, ISerializable serializable)
SendError Send(UInt32 commandid, T& data)
SendError SendClientInfo(Int64 clientID, String clientName)
SendError SendPing()
Task<Response<TResult>> SendR(UInt32 commandid, Byte[] data, Int32 offset, Int32 length)
Task<Response<TResult>> SendR(UInt32 commandid, Byte[] data, Int32 offset, Int32 length, DeserializePacket<TResult> deserialize)
Task<Response<TResult>> SendR(UInt32 commandid, Byte[] data, Int32 offset, Int32 length, TimeSpan timeout)
Task<Response<TResult>> SendR(UInt32 commandid, Byte[] data, Int32 offset, Int32 length, DeserializePacket<TResult> deserialize, TimeSpan timeout)
Task<Response<TResult>> SendR(UInt32 commandid, ISerializable serializable)
Task<Response<TResult>> SendR(UInt32 commandid, ISerializable serializable, DeserializePacket<TResult> deserialize)
Task<Response<TResult>> SendR(UInt32 commandid, ISerializable serializable, TimeSpan timeout)
Task<Response<TResult>> SendR(UInt32 commandid, ISerializable serializable, DeserializePacket<TResult> deserialize, TimeSpan timeout)
Task<Response<TResult>> SendR(UInt32 commandid, T& data)
Task<Response<TResult>> SendR(UInt32 commandid, T& data, DeserializePacket<TResult> deserialize)
Task<Response<TResult>> SendR(UInt32 commandid, T& data, TimeSpan timeout)
Task<Response<TResult>> SendR(UInt32 commandid, T& data, DeserializePacket<TResult> deserialize, TimeSpan timeout)
Task<Response<PING_STRUCT>> SendRPing()

ClientEap

A TCP/UDP-Client build with the "Event-based Asynchronous Pattern" (EAP)

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

CLIENTINFO_STRUCT

CLIENTINFO_STRUCT

public struct Exomia.Network.CLIENTINFO_STRUCT

Fields

Type Name Summary
Int64 ClientID ClientID
String ClientName ClientName (64)

CommandID

CommandID

public static class Exomia.Network.CommandID

Static Fields

Type Name Summary
UInt32 CLIENTINFO CLIENTINFO_ID
UInt32 CONNECT CONNECT_ID
UInt32 DISCONNECT DISCONNECT_ID
UInt32 PING PING_ID
UInt32 RESPONSE RESPONSE_ID

CONNECT_STRUCT

CONNECT_STRUCT

public struct Exomia.Network.CONNECT_STRUCT

Fields

Type Name Summary
Byte[] Checksum Checksum(16)

DisconnectReason

can be used to determine if a client has disconnected properly

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

Enum

Value Name Summary
Unspecified Unspecified Unspecified/Unknown Reason
Graceful Graceful Graceful
Aborted Aborted Aborted
Error Error Error

EncryptionMode

CryptographyMode

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

Enum

Value Name Summary
None None None
End2End End2End End2End

IClient

IClient interface

public interface Exomia.Network.IClient
    : IDisposable

Methods

Type Name Summary
Boolean Connect(SocketMode mode, String serverAddress, Int32 port, Int32 timeout = 10) trys to connect the client to a server
Boolean Connect(SocketMode mode, IPAddress[] ipAddresses, Int32 port, Int32 timeout = 10) trys to connect the client to a server
void Disconnect() call to disconnect from a server
SendError Send(UInt32 commandid, Byte[] data, Int32 offset, Int32 length) send data to the server
SendError Send(UInt32 commandid, ISerializable serializable) send data to the server
SendError Send(UInt32 commandid, T& data) send data to the server
SendError SendClientInfo(Int64 clientID, String clientName) send a client info command to the server
SendError SendPing() send a ping command to the server
Task<Response<TResult>> SendR(UInt32 commandid, Byte[] data, Int32 offset, Int32 length)
Task<Response<TResult>> SendR(UInt32 commandid, Byte[] data, Int32 offset, Int32 length, DeserializePacket<TResult> deserialize)
Task<Response<TResult>> SendR(UInt32 commandid, Byte[] data, Int32 offset, Int32 length, TimeSpan timeout)
Task<Response<TResult>> SendR(UInt32 commandid, Byte[] data, Int32 offset, Int32 length, DeserializePacket<TResult> deserialize, TimeSpan timeout)
Task<Response<TResult>> SendR(UInt32 commandid, ISerializable serializable)
Task<Response<TResult>> SendR(UInt32 commandid, ISerializable serializable, DeserializePacket<TResult> deserialize)
Task<Response<TResult>> SendR(UInt32 commandid, ISerializable serializable, TimeSpan timeout)
Task<Response<TResult>> SendR(UInt32 commandid, ISerializable serializable, DeserializePacket<TResult> deserialize, TimeSpan timeout)
Task<Response<TResult>> SendR(UInt32 commandid, T& data)
Task<Response<TResult>> SendR(UInt32 commandid, T& data, DeserializePacket<TResult> deserialize)
Task<Response<TResult>> SendR(UInt32 commandid, T& data, TimeSpan timeout)
Task<Response<TResult>> SendR(UInt32 commandid, T& data, DeserializePacket<TResult> deserialize, TimeSpan timeout)
Task<Response<PING_STRUCT>> SendRPing() send a ping command to the server

Packet

public struct Exomia.Network.Packet

Fields

Type Name Summary
Byte[] Buffer
Int32 Length
Int32 Offset

PING_STRUCT

PING_STRUCT

public struct Exomia.Network.PING_STRUCT

Fields

Type Name Summary
Int64 TimeStamp TimeStamp

Response<TResult>

public struct Exomia.Network.Response<TResult>

Fields

Type Name Summary
TResult Result Result
SendError SendError SendError

SendError

SendError enum

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

Enum

Value Name Summary
None None No error, all good
Socket Socket A socket exception is occured
Disposed Disposed The socket was disposed
Invalid Invalid The SEND_FLAG is not set
Unknown Unknown Unknown error occured

ServerBase<T, TServerClient>

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

Properties

Type Name Summary
Int32 Port Port

Events

Type Name Summary
ClientActionHandler<T> ClientConnected called than a client is connected
ClientDisconnectHandler<T> ClientDisconnected called than a client is disconnected

Methods

Type Name Summary
void AddCommand(UInt32 commandid, DeserializePacket<Object> deserialize) add a command
void AddDataReceivedCallback(UInt32 commandid, ClientDataReceivedHandler<T, TServerClient> callback) add a data received callback
void Dispose()
Boolean RemoveCommand(UInt32 commandid) remove a command
void RemoveDataReceivedCallback(UInt32 commandid, ClientDataReceivedHandler<T, TServerClient> callback) remove a data received callback
Boolean Run(Int32 port)
SendError SendTo(T arg0, UInt32 commandid, Byte[] data, Int32 offset, Int32 length, UInt32 responseid)
SendError SendTo(T arg0, UInt32 commandid, ISerializable serializable, UInt32 responseid)
SendError SendTo(T arg0, UInt32 commandid, T1& data, UInt32 responseid)
void SendToAll(UInt32 commandid, Byte[] data, Int32 offset, Int32 length)
void SendToAll(UInt32 commandid, T1& data)
void SendToAll(UInt32 commandid, ISerializable serializable)

ServerClientBase<T>

ServerClientBase{T} class

public abstract class Exomia.Network.ServerClientBase<T>

Properties

Type Name Summary
Object ClientInfo ClientInfo
EndPoint EndPoint EndPoint
IPAddress IPAddress IPAddress
DateTime LastReceivedPacketTimeStamp LastReceivedPacketTimeStamp

Events

Type Name Summary
ClientInfoHandler<ServerClientBase<T>, T> ClientInfoChanged called than the client info is changed

SocketMode

SocketMode

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

Enum

Value Name Summary
Tcp Tcp TCP
Udp Udp UDP