Version: 5.3 (switch to 5.4b)
ЯзыкEnglish
  • C#
  • JS

Язык программирования

Выберите подходящий для вас язык программирования. Все примеры кода будут представлены на выбранном языке.

NetworkConnection

class in UnityEngine.Networking

Предложить изменения

Успех!

Благодарим вас за то, что вы помогаете нам улучшить качество документации по Unity. Однако, мы не можем принять любой перевод. Мы проверяем каждый предложенный вами вариант перевода и принимаем его только если он соответствует оригиналу.

Закрыть

Ошибка внесения изменений

По определённым причинам предложенный вами перевод не может быть принят. Пожалуйста <a>попробуйте снова</a> через пару минут. И выражаем вам свою благодарность за то, что вы уделяете время, чтобы улучшить документацию по Unity.

Закрыть

Отменить

Руководство

Описание

High level network connection.

Переменные

addressThe IP address associated with the connection.
clientOwnedObjectsA list of the NetworkIdentity objects owned by this connection.
connectionIdUnique identifier for this connection.
hostIdTransport level host ID for this connection.
isConnectedTrue if the connection is connected to a remote end-point.
isReadyFlag that tells if the connection has been marked as "ready" by a client calling ClientScene.Ready().
lastMessageTimeThe last time that a message was received on this connection.
logNetworkMessagesSetting this to true will log the contents of network message to the console.
playerControllersThe list of players for this connection.
Networking.NetworkConnectionSetting this to true will log the contents of network packets to the console.

Открытые функции

CheckHandlerThis function checks if there is a message handler registered for the message ID.
DisconnectDisconnects this connection.
DisposeDisposes of this connection, releasing channel buffers that it holds.
FlushChannelsThis causes the channels of the network connection to flush their data to the transport layer.
GetStatsInGet statistics for incoming traffic.
GetStatsOutGet statistics for outgoing traffic.
HandleBytesThis makes the connection process the data contained in the buffer, and call handler functions.
HandleReaderThis makes the connection process the data contained in the stream, and call handler functions.
InitializeThis inializes the internal data structures of a NetworkConnection object, including channel buffers.
InvokeHandlerThis function invokes the registered handler function for a message.
InvokeHandlerNoDataThis function invokes the registered handler function for a message, without any message data.
RegisterHandlerThis registers a handler function for a message Id.
ResetStatsResets the statistics that are returned from NetworkClient.GetConnectionStats().
SendThis sends a network message with a message ID on the connection. This message is sent on channel zero, which by default is the reliable channel.
SendByChannelThis sends a network message on the connection using a specific transport layer channel.
SendBytesThis sends an array of bytes on the connection.
SendUnreliableThis sends a network message with a message ID on the connection. This message is sent on channel one, which by default is the unreliable channel.
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.
TransportRecieveThis virtual function allows custom network connection classes to process data from the network before it is passed to the application.
TransportSendThis virtual function allows custom network connection classes to process data send by the application before it goes to the network transport layer.
UnregisterHandlerThis removes the handler registered for a message Id.

Защищённые функции

HandleBytesThis makes the connection process the data contained in the buffer, and call handler functions.
HandleReaderThis makes the connection process the data contained in the stream, and call handler functions.