This is a network client class used by the networking system. It contains a NetworkConnection that is used to connect to a network server.
The NetworkClient handle connection state, messages handlers, and connection configuration. There can be many NetworkClient instances in a process at a time, but only one that is connected to a game server (NetworkServer) that uses spawned objects.
NetworkClient has an internal update function where it handles events from the transport layer. This includes asynchronous connect events, disconnect events and incoming data from a server.
The NetworkManager has a NetworkClient instance that it uses for games that it starts, but the NetworkClient may be used by itself.
active | True if a network client is currently active. |
allClients | A list of all the active network clients in the current process. |
connection | El objeto NetworkConnection que este cliente está utilizando. |
handlers | The registered network message handlers. |
hostPort | The local port that the network client uses to connect to the server. |
hostTopology | The host topology that this client is using. |
isConnected | This gives the current connection status of the client. |
networkConnectionClass | The class to use when creating new NetworkConnections. |
numChannels | The number of QoS channels currently configured for this client. |
serverIp | La dirección IP del servidor que este cliente esta conectado. |
serverPort | El puerto del servidor al cual este cliente está conectado. |
NetworkClient | Creates a new NetworkClient instance. |
Configure | This configures the transport layer settings for a client. |
Connect | Connect client to a NetworkServer instance. |
ConnectWithSimulator | Connect client to a NetworkServer instance with simulated latency and packet loss. |
Disconnect | Disconnect from server. |
GetConnectionStats | Retrieves statistics about the network packets sent on this connection. |
GetRTT | Gets the Return Trip Time for this connection. |
GetStatsIn | Get inbound network statistics for the client. |
GetStatsOut | Get outbound network statistics for the client. |
ReconnectToNewHost | This is used by a client that has lost the connection to the old host, to reconnect to the new host of a game. |
RegisterHandler | Register a handler for a particular message type. |
ResetConnectionStats | Resets the statistics return by NetworkClient.GetConnectionStats() to zero values. |
Send | This sends a network message with a message Id to the server. This message is sent on channel zero, which by default is the reliable channel. |
SendByChannel | This sends a network message with a message Id to the server on a specific channel. |
SendBytes | This sends the data in an array of bytes to the server that the client is connected to. |
SendUnreliable | This sends a network message with a message Id to the server on channel one, which by default is the unreliable channel. |
SendWriter | This sends the contents of the NetworkWriter's buffer to the connected server on the specified channel. |
SetMaxDelay | Set the maximum amount of time that can pass for transmitting the send buffer. |
SetNetworkConnectionClass | This sets the class that is used when creating new network connections. |
Shutdown | Shut down a client. |
UnregisterHandler | Unregisters a network message handler. |
GetTotalConnectionStats | Retrieves statistics about the network packets sent on all connections. |
ShutdownAll | Shuts down all network clients. |