Class INetworkDriver
Basic interface for the low-level network transport/driver.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Networking/INetworkDriver.h
Syntax
public class INetworkDriver
Constructors
~INetworkDriver()
Finalizes an instance of the INetworkDriver class.
Declaration
public virtual ~INetworkDriver() = default
Methods
Connect()
Starts connection handshake with the end point specified in the NetworkConfig
Declaration
public virtual bool Connect() = 0
Returns
bool
True when succeeded. |
Disconnect()
Disconnects from the server.
Can be used only by the client!
Declaration
public virtual void Disconnect() = 0
Disconnect(const NetworkConnection& connection)
Disconnects given connection from the server.
Can be used only by the server!
Declaration
public virtual void Disconnect(const NetworkConnection& connection) = 0
Parameters
NetworkConnection
connection
|
Dispose()
Disposes this driver making it no longer usable. Reserved for resource deallocation etc.
Declaration
public virtual void Dispose() = 0
DriverName()
Return name of this network driver implementation.
Declaration
public virtual String DriverName()
Returns
String
|
GetStats()
Gets the network transport layer stats.
Declaration
public virtual NetworkDriverStats GetStats() = 0
Returns
NetworkDriverStats
Network transport statistics data for a given connection. |
GetStats(NetworkConnection target)
Gets the network transport layer stats for a given connection.
Declaration
public virtual NetworkDriverStats GetStats(NetworkConnection target) = 0
Parameters
NetworkConnection
target
The client connection to retrieve statistics for. |
Returns
NetworkDriverStats
Network transport statistics data for a given connection. |
Initialize(NetworkPeer* host, const NetworkConfig& config)
Initializes the instance of this network driver using given configuration.
Declaration
public virtual bool Initialize(NetworkPeer* host, const NetworkConfig& config) = 0
Parameters
NetworkPeer
host
The peer that this driver has been assigned to. |
NetworkConfig
config
The network config to use to configure this driver. |
Returns
bool
True if failed to initialize network driver, false otherwise. |
Listen()
Starts listening for incoming connections. Once this is called, this driver becomes a server.
Declaration
public virtual bool Listen() = 0
Returns
bool
True when succeeded. |
PopEvent(NetworkEvent& eventPtr)
Tries to pop an network event from the queue.
Declaration
public virtual bool PopEvent(NetworkEvent& eventPtr) = 0
Parameters
NetworkEvent
eventPtr
The pointer to event structure. |
Returns
bool
True when succeeded and the event can be processed. |
SendMessage(NetworkChannelType channelType, const NetworkMessage& message)
Sends given message over specified channel to the server.
Can be used only by the client!
Declaration
public virtual void SendMessage(NetworkChannelType channelType, const NetworkMessage& message) = 0
Parameters
NetworkChannelType
channelType
The channel to send the message over. |
NetworkMessage
message
The message. |
SendMessage(NetworkChannelType channelType, const NetworkMessage& message, const Array<NetworkConnection, HeapAllocation>& targets)
Sends given message over specified channel to the given client connection (target).
Can be used only by the server!
Declaration
public virtual void SendMessage(NetworkChannelType channelType, const NetworkMessage& message, const Array<NetworkConnection, HeapAllocation>& targets) = 0
Parameters
NetworkChannelType
channelType
The channel to send the message over. |
NetworkMessage
message
The message. |
Array<NetworkConnection, HeapAllocation>
targets
The connections list to send the message to. |
SendMessage(NetworkChannelType channelType, const NetworkMessage& message, NetworkConnection target)
Sends given message over specified channel to the given client connection (target).
Can be used only by the server!
Declaration
public virtual void SendMessage(NetworkChannelType channelType, const NetworkMessage& message, NetworkConnection target) = 0
Parameters
NetworkChannelType
channelType
The channel to send the message over. |
NetworkMessage
message
The message. |
NetworkConnection
target
The client connection to send the message to. |