-
-
Notifications
You must be signed in to change notification settings - Fork 3
Exomia.Network
A TCP/UDP-Client base.
public abstract class Exomia.Network.ClientBase
: IClient, IDisposable
void
AddCommand(UInt32
commandid, DeserializePacketHandler
deserialize)
add a command.
-
commandid
- command id. -
deserialize
- .
void
AddDataReceivedCallback(UInt32
commandid, DataReceivedHandler
callback)
add a data received callback.
-
commandid
- command id. -
callback
- callback.
SendError
BeginSendData(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length, UInt32
responseID)
Begins send data.
-
commandid
- command id. -
data
- The data. -
offset
- The offset. -
length
- The length. -
responseID
- Identifier for the response.
Boolean
Connect(IPAddress[]
ipAddresses, Int32
port, Int32
timeout = 10)
try's to connect the client to a server.
-
ipAddresses
- . -
port
- . -
timeout
- (Optional)
Boolean
Connect(String
serverAddress, Int32
port, Int32
timeout = 10)
try's to connect the client to a server.
-
serverAddress
- . -
port
- . -
timeout
- (Optional)
void
DeserializeData(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length, UInt32
responseid)
Deserialize data.
-
commandid
- command id. -
data
- The data. -
offset
- The offset. -
length
- The length. -
responseid
- The responseid.
void
Disconnect(DisconnectReason
reason)
Disconnects the given reason.
-
reason
- The reason to disconnect.
void
Dispose()void
RemoveDataReceivedCallback(UInt32
commandid, DataReceivedHandler
callback)
remove a data received callback.
-
commandid
- command id. -
callback
- DataReceivedHandler.
SendError
Send(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length)
send data to the server.
-
commandid
- command id. -
data
- data. -
offset
- offset. -
length
- length of data.
SendError
Send(UInt32
commandid, ISerializable
serializable)
send data to the server.
-
commandid
- command id. -
serializable
- ISerializable.
SendError
Send(UInt32
commandid, T&
data)
send data to the server.
-
commandid
- command id. -
data
- struct data.
Task>
SendR(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length)
send data to the server.
-
commandid
- command id. -
data
- data. -
offset
- offset. -
length
- length of data.
Task>
SendR(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length, DeserializePacketHandler
deserialize)
send data to the server.
-
commandid
- command id. -
data
- data. -
offset
- offset. -
length
- length of data. -
deserialize
- .
Task>
SendR(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
data
- data. -
offset
- offset. -
length
- length of data. -
timeout
- timeout.
Task>
SendR(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length, DeserializePacketHandler
deserialize, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
data
- data. -
offset
- offset. -
length
- length of data. -
deserialize
- . -
timeout
- timeout.
Task>
SendR(UInt32
commandid, ISerializable
serializable)
send data to the server.
-
commandid
- command id. -
serializable
- ISerializable.
Task>
SendR(UInt32
commandid, ISerializable
serializable, DeserializePacketHandler
deserialize)
send data to the server.
-
commandid
- command id. -
serializable
- ISerializable. -
deserialize
- .
Task>
SendR(UInt32
commandid, ISerializable
serializable, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
serializable
- ISerializable. -
timeout
- timeout.
Task>
SendR(UInt32
commandid, ISerializable
serializable, DeserializePacketHandler
deserialize, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
serializable
- ISerializable. -
deserialize
- . -
timeout
- timeout.
Task>
SendR(UInt32
commandid, T&
data)
send data to the server.
-
commandid
- command id. -
data
- struct data.
Task>
SendR(UInt32
commandid, T&
data, DeserializePacketHandler
deserialize)
send data to the server.
-
commandid
- command id. -
data
- struct data. -
deserialize
- .
Task>
SendR(UInt32
commandid, T&
data, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
data
- struct data. -
timeout
- timeout.
Task>
SendR(UInt32
commandid, T&
data, DeserializePacketHandler
deserialize, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
data
- struct data. -
deserialize
- . -
timeout
- timeout.
Boolean
TryCreateSocket(Socket&
socket)
Attempts to create socket.
-
socket
- [out] The socket.
CommandID.
public static class Exomia.Network.CommandID
Values that represent CompressionMode. MASK 0b00111000.
public enum Exomia.Network.CompressionMode
: Enum, IComparable, IFormattable, IConvertible
can be used to determine if a client has disconnected properly.
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, Int32
timeout = 10)
try's to connect the client to a server.
-
serverAddress
- . -
port
- . -
timeout
- (Optional)
Boolean
Connect(IPAddress[]
ipAddresses, Int32
port, Int32
timeout = 10)
try's to connect the client to a server.
-
ipAddresses
- . -
port
- . -
timeout
- (Optional)
SendError
Send(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length)
send data to the server.
-
commandid
- command id. -
data
- data. -
offset
- offset. -
length
- length of data.
SendError
Send(UInt32
commandid, ISerializable
serializable)
send data to the server.
-
commandid
- command id. -
serializable
- ISerializable.
SendError
Send(UInt32
commandid, T&
data)
send data to the server.
-
commandid
- command id. -
data
- struct data.
Task>
SendR(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length)
send data to the server.
-
commandid
- command id. -
data
- data. -
offset
- offset. -
length
- length of data.
Task>
SendR(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length, DeserializePacketHandler
deserialize)
send data to the server.
-
commandid
- command id. -
data
- data. -
offset
- offset. -
length
- length of data. -
deserialize
- .
Task>
SendR(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
data
- data. -
offset
- offset. -
length
- length of data. -
timeout
- timeout.
Task>
SendR(UInt32
commandid, Byte[]
data, Int32
offset, Int32
length, DeserializePacketHandler
deserialize, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
data
- data. -
offset
- offset. -
length
- length of data. -
deserialize
- . -
timeout
- timeout.
Task>
SendR(UInt32
commandid, ISerializable
serializable)
send data to the server.
-
commandid
- command id. -
serializable
- ISerializable.
Task>
SendR(UInt32
commandid, ISerializable
serializable, DeserializePacketHandler
deserialize)
send data to the server.
-
commandid
- command id. -
serializable
- ISerializable. -
deserialize
- .
Task>
SendR(UInt32
commandid, ISerializable
serializable, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
serializable
- ISerializable. -
timeout
- timeout.
Task>
SendR(UInt32
commandid, ISerializable
serializable, DeserializePacketHandler
deserialize, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
serializable
- ISerializable. -
deserialize
- . -
timeout
- timeout.
Task>
SendR(UInt32
commandid, T&
data)
send data to the server.
-
commandid
- command id. -
data
- struct data.
Task>
SendR(UInt32
commandid, T&
data, DeserializePacketHandler
deserialize)
send data to the server.
-
commandid
- command id. -
data
- struct data. -
deserialize
- .
Task>
SendR(UInt32
commandid, T&
data, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
data
- struct data. -
timeout
- timeout.
Task>
SendR(UInt32
commandid, T&
data, DeserializePacketHandler
deserialize, TimeSpan
timeout)
send data to the server.
-
commandid
- command id. -
data
- struct data. -
deserialize
- . -
timeout
- timeout.
Packet readonly struct.
public struct Exomia.Network.Packet
.ctor
Packet(Byte[]
buffer, Int32
offset, Int32
length)
Initializes a new instance of the Exomia.Network.Packet struct.
-
buffer
- . -
offset
- . -
length
- .
A response.
public struct Exomia.Network.Response<TResult>
.ctor
Response`1(TResult&
result, SendError
sendError)
Initializes a new instance of the <see cref="Response<TResult>"/> struct.
-
result
- Result. -
sendError
- SendError.
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<T>, IDisposable
void
AddCommand(UInt32
commandid, DeserializePacketHandler
deserialize)
add a command.
-
commandid
- command id. -
deserialize
- .
void
AddDataReceivedCallback(UInt32
commandid, ClientDataReceivedHandler
callback)
add a data received callback.
-
commandid
- command id. -
callback
- ClientDataReceivedHandler{Socket|Endpoint}
Boolean
CreateServerClient(T
arg0, TServerClient&
serverClient)
Create a new ServerClient than a client connects.
-
arg0
- Socket|EndPoint. -
serverClient
- [out] out new ServerClient.
void
DeserializeData(T
arg0, UInt32
commandid, Byte[]
data, Int32
offset, Int32
length, UInt32
responseid)
Deserialize data.
-
arg0
- Socket|Endpoint. -
commandid
- command id. -
data
- The data. -
offset
- The offset. -
length
- The length. -
responseid
- The responseid.
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
OnAfterClientDisconnect(T
arg0)
called after Exomia.Network.ServerBase`2.InvokeClientDisconnect(`0,Exomia.Network.DisconnectReason).
-
arg0
- Socket|EndPoint.
void
OnClientConnected(T
arg0)
called than a new client is connected.
-
arg0
- Socket|Endpoint.
void
OnClientDisconnected(T
arg0, DisconnectReason
reason)
called then the client is connected.
-
arg0
- Socket|EndPoint. -
reason
- DisconnectReason.
Boolean
OnRun(Int32
port, Socket&
listener)
Executes the run action.
-
port
- Port. -
listener
- [out] The listener.
Boolean
RemoveCommand(UInt32
commandid)
remove a command.
-
commandid
- command id.
void
RemoveDataReceivedCallback(UInt32
commandid, ClientDataReceivedHandler
callback)
remove a data received callback.
-
commandid
- command id. -
callback
- ClientDataReceivedHandler{Socket|Endpoint}
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} class.
public abstract class Exomia.Network.ServerClientBase<T>
.ctor
ServerClientBase`1(T
arg0)
ServerClientBase constructor.
-
arg0
- Socket|Endpoint.