Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

NetworkTransport

class in UnityEngine.Networking

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual

Descripción

Low level (transport layer) API.

Variables Estáticas

IsStartedObsolete, will be removed.

Funciones Estáticas

AddHostWill create a host (open socket) with given topology and optionally port and IP.
AddHostWithSimulatorCreate a host (open socket) and configure them to simulate internet latency (works on editor and development build only).
AddWebsocketHostCreated web socket host. This function is supported only for Editor (Win, Linux, Mac) and StandalonePlayers (Win, Linux, Mac) Topology is used to define how many client can connect, and how many messages should be preallocated in send and receive pool, all other parameters are ignored.
ConnectTry to establish connection to another peer.
ConnectAsNetworkHostCreate dedicated connection to relay server.
ConnectEndPointTry to establish connection to other peer, where the peer is specified using a C# System.EndPoint.
ConnectToNetworkPeerCreate connection to other peer in the relay group.
ConnectWithSimulatorConnect with simulated latency.
DisconnectSend disconnect signal to peer and close connection. user should call Receive() to be notified that connection is closed. This signal will send only once (best effort delivery) iif this packet will dropped by some reason, peer will close connection by timeout.
DisconnectNetworkHostAplyed only for client which has been already owner of the same group of relay server. it will disconnect this owner from the group, group will be distracted or (if it supported) one of the member of this group should became new owner (owner migration).
FinishSendMulticastFunction will finalize sending message to group of connection. (only one multicast message per time is allowed for host).
GetAssetIdThe UNet spawning system uses assetIds to identify how spawn remote objects. This function allows you to get the assetId for the prefab associated with an object.
GetBroadcastConnectionInfoIf Receive() function returns BroadcastEvent, immedeately this function will return connection info of broadcast sender. This info can be used for connection to broadcast sender.
GetBroadcastConnectionMessageIf Receive() function returns BroadcastEvent, immedeately this function will return complimentary message of broadcast sender.
GetConnectionInfoReturn connection parameters of connected connection, this parameters can be sent to other user which can establish direct connection to this peer. If peer connected via relay, relay related parameters will be not invalid.
GetCurrentIncomingMessageAmountReturn value of messages waiting for reading.
GetCurrentOutgoingMessageAmountReturn total message amount waiting for sending.
GetCurrentRttReturn round trip time for connection.
GetNetIOTimeuSFunction returns time spent on network io operations in micro seconds.
GetNetworkLostPacketNumReturn total number of packets has been lost from start.
GetNetworkTimestampGet UNET timestamp which can be added to message for further definitions of packet delaying.
GetPacketReceivedRateReturn current receive rate in bytes per sec.
GetPacketSentRateReurn outgoing rate in bytes per second.
GetRemoteDelayTimeMSReturn time delay for timestamp received from message (previously created by GetNetworkTimestamp()).
InitFirst function which should be called before any other NetworkTransport function.
IsBroadcastDiscoveryRunningCheck if broadcastdiscovery sender works.
ReceiveDeliver network events to user.
ReceiveFromHostSimilar to Receive() but will ask only provided host. It for example allows to mix server/client in the same game.
ReceiveRelayEventFromHostFunction delivered relay group event for group owner.
RemoveHostClose opened socket, close all connection belonging this socket.
SendSend data to peer.
SendMulticastFunction adds another connection to multy peer sends.
SetBroadcastCredentialsSet credentials for received broadcast message. If one of credentials is wrong, received brodcast discovery message will drop.
SetPacketStatUsed to inform the profiler of network packet statistics.
ShutdownShutdown the transport layer, after calling this function no any other function can be called.
StartBroadcastDiscoveryFunction starts send broadcasting message in all local subnets.
StartSendMulticastStart process sending message per group of connected connection.
StopBroadcastDiscoveryStop sending broadcast discovery message.