Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

NetworkConnection

class in UnityEngine.Networking

Suggest a change

Success!

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

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Description

High level UNET connection.

Variables

addressThe IP address associated with the connection.
connectionIdUnique identifier for this connection.
hostIdTransport level host id for this connection.
isReadyFlag that tells if the connection has been marked as "ready" by a client calling NetworkClient.Ready().
lastMessageTimeThe last time that a message was received on this connection.
playerControllersThe list of players for this connection.

Public Functions

DisconnectDisconnects this connection.
DisposeDisposes of this connection, releasing channel buffers that it holds.
GetStatsInGet statistics for incoming traffic.
GetStatsOutGet statistics for outgoing traffic.
InitializeThis inializes the internal data structures of a NetworkConnection object, including channel buffers.
ResetStatsResets the statistics that are returned from NetworkClient.GetConnectionStats().
SendThis sends the contents of the message structure with the message type.
SendByChannelSends a message on a specific channel.
SendBytesThis sends an array of bytes on the connection.
SendUnreliableThis sends the contents of the message structure with the message id.
SendWriterThis sends the contents of a NetworkWriter object on the connection.
SetChannelOptionThis sets an option on the network channel.
SetMaxDelayThe maximum time in seconds that messages are buffered before being sent.
ToStringReturns a string representation of the NetworkConnection object state.