Select your preferred scripting language. All code snippets will be displayed in this language.
class in UnityEngine.Networking
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.Close
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.Close
This is a network client class used by the networking system. It contains a NetworkConnection that is used to connection 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.
|True if a network client is currently active.
|A list of all the active network clients in the current process.
|The NetworkConnection object this client is using.
|The registered network message handlers.
|The local port that the network client uses to connect to the server.
|The host topology that this client is using.
|This gives the current connection status of the client.
|The class to use when creating new NetworkConnections.
|The number of QoS channels currently configured for this client.
|The IP address of the server that this client is connected to.
|The port of the server that this client is connected to.
|Creates a new NetworkClient instance.
|This configures the transport layer settings for a client.
|Connect client to a NetworkServer instance.
|Connect client to a NetworkServer instance with simulated latency and packet loss.
|Disconnect from server.
|Retrieves statistics about the network packets sent on this connection.
|Gets the Return Trip Time for this connection.
|Get inbound network statistics for the client.
|Get outbound network statistics for the client.
|This is used by a client that has lost the connection to the old host, to reconnect to the new host of a game.
|Register a handler for a particular message type.
|Resets the statistics return by NetworkClient.GetConnectionStats() to zero values.
|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.
|This sends a network message with a message Id to the server on a specific channel.
|This sends the data in an array of bytes to the server that the client is connected to.
|This sends a network message with a message Id to the server on channel one, which by default is the unreliable channel.
|This sends the contents of the NetworkWriter's buffer to the connected server on the specified channel.
|Set the maximum amount of time that can pass for transmitting the send buffer.
|This sets the class that is used when creating new network connections.
|Shut down a client.
|Unregisters a network message handler.
Did you find this page useful? Please give it a rating: