Version: 5.3

NetworkTransport

class in UnityEngine.Networking

매뉴얼로 전환

설명

Low level (transport layer) API.

정적 함수

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).
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.
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.