-
-
Notifications
You must be signed in to change notification settings - Fork 4
Exomia.Network
A TCP/UDP-Client base.
public abstract class Exomia.Network.ClientBase
: IClient, IDisposable
.ctor
ClientBase(Byte
listenerCount = 1)
Initializes a new instance of the class.
-
listenerCount
- (Optional) The listener count.
Socket
_clientSocketEncryptionMode
_encryptionModeByte
_stateUInt16
MaxPayloadSizevoid
AddCommand(UInt16
commandID, DeserializePacketHandler
deserialize)
add a command deserializer.
-
commandID
- Identifier for the command. -
deserialize
- The deserialize handler.
void
AddCommand(UInt16[]
commandIDs, DeserializePacketHandler
deserialize)
add commands deserializers.
-
commandIDs
- The command ids. -
deserialize
- The deserialize handler.
void
AddDataReceivedCallback(UInt16
commandID, DataReceivedHandler
callback)
add a data received callback.
-
commandID
- Identifier for the command. -
callback
- The callback.
SendError
BeginSend(PacketInfo&
packetInfo)
Begins send data.
-
packetInfo
- Information describing the packet.
Boolean
Connect(IPAddress[]
ipAddresses, Int32
port, Action
overwriteConfigure = null, Int32
timeout = 10)
try's to connect the client to a server.
-
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)
try's to connect the client to a server.
-
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(DisconnectReason
reason)void
Dispose()void
ReceiveAsync()Boolean
RemoveCommands(UInt16[]
commandIDs)
Removes the commands described by commandIDs.
-
commandIDs
- A variable-length parameters list containing command ids.
void
RemoveDataReceivedCallback(UInt16
commandID, DataReceivedHandler
callback)
remove a data received callback.
-
commandID
- Identifier for the command. -
callback
- The callback.
SendError
Send(UInt16
commandOrResponseID, Byte[]
data, Int32
offset, Int32
length, Boolean
isResponse = False)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
commandOrResponseID
- Identifier for the command or response. -
serializable
- ISerializable. -
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
commandOrResponseID
- Identifier for the command or response. -
data
- The data. -
deserialize
- The deserialize. -
timeout
- The timeout. -
isResponse
- (Optional) True if this object is response.
Boolean
TryCreateSocket(Socket&
socket)Byte
RECEIVE_FLAGByte
SEND_FLAGValues that represent CompressionMode.
MASK 0b00011000.
public enum Exomia.Network.CompressionMode
: Enum, IComparable, IFormattable, IConvertible
Values that represent DisconnectReason.
public enum Exomia.Network.DisconnectReason
: Enum, IComparable, IFormattable, IConvertible
Values that represent EncryptionMode.
MASK 0b00000111.
public enum Exomia.Network.EncryptionMode
: Enum, IComparable, IFormattable, IConvertible
IClient interface.
public interface Exomia.Network.IClient
: IDisposable
Boolean
Connect(String
serverAddress, Int32
port, Action
overwriteConfigure = null, Int32
timeout = 10)
try's to connect the client to a server.
-
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)
try's to connect the client to a server.
-
ipAddresses
- The ip addresses. -
port
- The port. -
overwriteConfigure
- (Optional) Overwrite the default configuration. -
timeout
- (Optional) The timeout in seconds.
SendError
Send(UInt16
commandOrResponseID, Byte[]
data, Int32
offset, Int32
length, Boolean
isResponse = False)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
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)
send data to the server.
-
commandOrResponseID
- Identifier for the command or response. -
data
- The data. -
deserialize
- The deserialize. -
timeout
- The timeout. -
isResponse
- (Optional) True if this object is response.
Interface for server.
public interface Exomia.Network.IServer<TServerClient>
: IDisposable
SendError
SendTo(TServerClient
client, UInt16
commandOrResponseID, Byte[]
data, Int32
offset, Int32
length, Boolean
isResponse = False)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
Sends data to all clients.
-
commandOrResponseID
- Identifier for the command or response. -
data
- The data. -
offset
- The offset. -
length
- The length.
void
SendToAll(UInt16
commandOrResponseID, Byte[]
data)
Sends data to all clients.
-
commandOrResponseID
- Identifier for the command or response. -
data
- The data.
void
SendToAll(UInt16
commandOrResponseID, ISerializable
serializable)
Sends data to all clients.
-
commandOrResponseID
- Identifier for the command or response. -
serializable
- The serializable.
void
SendToAll(UInt16
commandOrResponseID, T1&
data)
Sends data to all clients.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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)
send data to the client.
-
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.
Interface for server client.
public interface Exomia.Network.IServerClient
DateTime
LastReceivedPacketTimeStamp
Gets the Date/Time of the last received packet time stamp.
Packet readonly struct.
public struct Exomia.Network.Packet
.ctor
Packet(Byte[]
buffer, Int32
offset, Int32
length)
Initializes a new instance of the struct.
-
buffer
- The buffer. -
offset
- The offset. -
length
- The length.
String
ToString()String
ToString(Encoding
encoding)
Convert this packets raw data into a string representation.
-
encoding
- The encoding.
A response.
public struct Exomia.Network.Response<TResult>
.ctor
Response`1(TResult&
result, UInt16
responseID, SendError
sendError)
Initializes a new instance of the struct.
-
result
- The result. -
responseID
- The result. -
sendError
- The send error.
UInt16
ID
The response id.
Specify this id instead of a command id in case you need to respond to a request.
Values that represent SendError.
public enum Exomia.Network.SendError
: Enum, IComparable, IFormattable, IConvertible
A server base.
public abstract class Exomia.Network.ServerBase<T, TServerClient>
: IServer<TServerClient>, IDisposable
.ctor
ServerBase`2(Byte
listenerCount = 1)
Initializes a new instance of the class.
-
listenerCount
- (Optional) The listener count.
EncryptionMode
_encryptionModeSocket
_listenerInt32
_portByte
_stateUInt16
MaxPayloadSizeClientCommandDataReceivedHandler
ClientDataReceived
Occurs when data from a client is received.
void
AddCommand(UInt16
commandID, DeserializePacketHandler
deserialize)
add a command deserializer.
-
commandID
- Identifier for the command. -
deserialize
- The deserialize handler.
void
AddCommand(UInt16[]
commandIDs, DeserializePacketHandler
deserialize)
add commands deserializers.
-
commandIDs
- The command ids. -
deserialize
- The deserialize handler.
void
AddDataReceivedCallback(UInt16
commandID, ClientDataReceivedHandler
callback)
add a data received callback.
-
commandID
- Identifier for the command. -
callback
- ClientDataReceivedHandler{Socket|Endpoint}
SendError
BeginSendTo(T
arg0, PacketInfo&
packetInfo)
Begins send data to.
-
arg0
- The argument 0. -
packetInfo
- Information describing the packet.
Boolean
CreateServerClient(TServerClient&
serverClient)
Create a new ServerClient than a client connects.
-
serverClient
- [out] out new ServerClient.
void
DeserializeData(T
arg0, DeserializePacketInfo&
deserializePacketInfo)
Deserialize data.
-
arg0
- Socket|Endpoint. -
deserializePacketInfo
- Information describing the deserialize packet.
void
Dispose()void
InvokeClientDisconnect(T
arg0, DisconnectReason
reason)
Executes the client disconnect on a different thread, and waits for the result.
-
arg0
- Socket|Endpoint. -
reason
- DisconnectReason.
void
InvokeClientDisconnect(TServerClient
client, DisconnectReason
reason)
Executes the client disconnect on a different thread, and waits for the result.
-
client
- The client. -
reason
- DisconnectReason.
void
OnAfterClientDisconnect(TServerClient
client)
called after .
-
client
- The client.
void
OnClientConnected(TServerClient
client)
Called than a new client is connected.
-
client
- The client.
void
OnClientDisconnected(TServerClient
client, DisconnectReason
reason)
Called then the client is disconnected.
-
client
- The client. -
reason
- DisconnectReason.
Boolean
OnRun(Int32
port, Socket&
listener)
Executes the run action.
-
port
- The port. -
listener
- [out] The listener.
Boolean
RemoveCommands(UInt16[]
commandIDs)
Removes the commands described by commandIDs.
-
commandIDs
- A variable-length parameters list containing command ids.
void
RemoveDataReceivedCallback(UInt16
commandID, ClientDataReceivedHandler
callback)
remove a data received callback.
-
commandID
- Identifier for the command. -
callback
- ClientDataReceivedHandler{Socket|Endpoint}
Boolean
Run(Int32
port, Action>
overwriteConfigure = null)
Runs.
-
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)Int32
CLOSE_TIMEOUTByte
RECEIVE_FLAGByte
SEND_FLAGA server client base.
public abstract class Exomia.Network.ServerClientBase<T>
: IServerClient
T
_arg0T
Arg0DateTime
LastReceivedPacketTimeStamp
Gets the Date/Time of the last received packet time stamp.
void
SetLastReceivedPacketTimeStamp()