Class ENetDriver
Low-level network transport interface implementation based on ENet library.
Namespace: FlaxEngine.Networking
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class ENetDriver : Object, INetworkDriver
Constructors
ENetDriver()
Methods
Connect()
Starts connection handshake with the end point specified in the NetworkConfig structure. Once this is called, this driver becomes a client.
Declaration
[Unmanaged]
public bool Connect()
Returns
System.Boolean
True when succeeded. |
Implements
Disconnect()
Disconnects from the server.
Declaration
[Unmanaged]
public void Disconnect()
Implements
Remarks
Can be used only by the client!
Disconnect(NetworkConnection)
Disconnects given connection from the server.
Declaration
[Unmanaged]
public void Disconnect(NetworkConnection connection)
Parameters
NetworkConnection
connection
|
Implements
Remarks
Can be used only by the server!
Dispose()
Disposes this driver making it no longer usable. Reserved for resource deallocation etc.
Declaration
[Unmanaged]
public void Dispose()
Implements
DriverName()
Return name of this network driver implementation.
Declaration
[Unmanaged]
public string DriverName()
Returns
System.String
|
Implements
GetStats()
Gets the network transport layer stats.
Declaration
[Unmanaged]
public NetworkDriverStats GetStats()
Returns
NetworkDriverStats
Network transport statistics data for a given connection. |
Implements
GetStats(NetworkConnection)
Gets the network transport layer stats for a given connection.
Declaration
[Unmanaged]
public NetworkDriverStats GetStats(NetworkConnection target)
Parameters
NetworkConnection
target
The client connection to retrieve statistics for. |
Returns
NetworkDriverStats
Network transport statistics data for a given connection. |
Implements
Initialize(NetworkPeer, NetworkConfig)
Initializes the instance of this network driver using given configuration.
Declaration
[Unmanaged]
public bool Initialize(NetworkPeer host, NetworkConfig config)
Parameters
NetworkPeer
host
The peer that this driver has been assigned to. |
NetworkConfig
config
The network config to use to configure this driver. |
Returns
System.Boolean
True if failed to initialize network driver, false otherwise. |
Implements
Listen()
Starts listening for incoming connections. Once this is called, this driver becomes a server.
Declaration
[Unmanaged]
public bool Listen()
Returns
System.Boolean
True when succeeded. |
Implements
PopEvent(out NetworkEvent)
Tries to pop an network event from the queue.
Declaration
[Unmanaged]
public bool PopEvent(out NetworkEvent eventPtr)
Parameters
NetworkEvent
eventPtr
The pointer to event structure. |
Returns
System.Boolean
True when succeeded and the event can be processed. |
Implements
SendMessage(NetworkChannelType, NetworkMessage)
Sends given message over specified channel to the server.
Declaration
[Unmanaged]
public void SendMessage(NetworkChannelType channelType, NetworkMessage message)
Parameters
NetworkChannelType
channelType
The channel to send the message over. |
NetworkMessage
message
The message. |
Implements
Remarks
Can be used only by the client!
SendMessage(NetworkChannelType, NetworkMessage, NetworkConnection)
Sends given message over specified channel to the given client connection (target).
Declaration
[Unmanaged]
public void SendMessage(NetworkChannelType channelType, NetworkMessage message, NetworkConnection target)
Parameters
NetworkChannelType
channelType
The channel to send the message over. |
NetworkMessage
message
The message. |
NetworkConnection
target
The client connection to send the message to. |
Implements
Remarks
Can be used only by the server!
SendMessage(NetworkChannelType, NetworkMessage, NetworkConnection[])
Sends given message over specified channel to the given client connection (target).
Declaration
[Unmanaged]
public void SendMessage(NetworkChannelType channelType, NetworkMessage message, NetworkConnection[] targets)
Parameters
NetworkChannelType
channelType
The channel to send the message over. |
NetworkMessage
message
The message. |
NetworkConnection[]
targets
The connections list to send the message to. |
Implements
Remarks
Can be used only by the server!