Class NetworkLagDriver
Low-level network transport interface implementation that is proxy of another nested INetworkDriver implementation but with lag simulation feature.
Namespace: FlaxEngine.Networking
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class NetworkLagDriver : Object, INetworkDriver
Constructors
NetworkLagDriver()
Properties
Driver
Gets or sets or sets the nested INetworkDriver to use as a proxy with lags.
Declaration
[Unmanaged]
public INetworkDriver Driver { get; set; }
Property Value
INetworkDriver
|
Lag
Network lag value in milliseconds. Adds a delay between sending and receiving messages (2 * Lag is TTL).
Declaration
[Unmanaged]
public float Lag { get; set; }
Property Value
System.Single
|
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!