Version: 2017.3

NetworkTransport

class in UnityEngine.Networking

매뉴얼로 전환

설명

Transport Layer API.

정적 변수

IsStartedDeprecated.

정적 함수

AddHostCreates a host based on HostTopology.
AddHostWithSimulatorCreate a host and configure them to simulate Internet latency (works on Editor and development build only).
AddWebsocketHostCreated web socket host.
ConnectTries to establish a 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 a connection to another peer in the Relay group.
ConnectWithSimulatorConnect with simulated latency.
DisconnectSend a disconnect signal to the connected peer and close the connection. Poll NetworkTransport.Receive() to be notified that the connection is closed. This signal is only sent once (best effort delivery). If this packet is dropped for some reason, the peer closes the connection by timeout.
DisconnectNetworkHostThis will disconnect the host and disband the group. DisconnectNetworkHost can only be called by the group owner on the relay server.
FinishSendMulticastFinalizes sending of a message to a group of connections. Only one multicast message at a time is allowed per host.
GetAckBufferCountReturns size of reliable buffer.
GetAssetIdThe Unity Multiplayer spawning system uses assetIds to identify what remote objects to spawn. This function allows you to get the assetId for the prefab associated with an object.
GetBroadcastConnectionInfoAfter NetworkTransport.Receive() returns NetworkEventType.BroadcastEvent, this function will return the connection information of the broadcast sender. This information can then be used for connecting to the broadcast sender.
GetBroadcastConnectionMessageAfter NetworkTransport.Receive() returns NetworkEventType.BroadcastEvent, this function returns a complimentary message from the broadcast sender.
GetConnectionInfoReturns the connection parameters for the specified connectionId. These parameters can be sent to other users to establish a direct connection to this peer. If this peer is connected to the host via Relay, the Relay-related parameters are set.
GetCurrentRTTReturn the round trip time for the given connectionId.
GetIncomingMessageQueueSizeReturns the number of received messages waiting in the queue for processing.
GetIncomingPacketCountReturns how many packets have been received from start for connection.
GetIncomingPacketCountForAllHostsReturns how many packets have been received from start. (from NetworkTransport.Init call).
GetIncomingPacketDropCountForAllHostsHow many packets have been dropped due lack space in incoming queue (absolute value, countinf from start).
GetIncomingPacketLossCountReturns how many incoming packets have been lost due transmitting (dropped by network).
GetMaxAllowedBandwidthGets the currently-allowed network bandwidth in bytes per second. The value returned can vary because bandwidth can be throttled by flow control. If the bandwidth is throttled to zero, the connection is disconnected.ted.
GetNetworkTimestampGet a network timestamp. Can be used in your messages to investigate network delays together with Networking.GetRemoteDelayTimeMS.
GetOutgoingFullBytesCountReturns how much raw data (in bytes) have been sent from start for all hosts (from NetworkTransport.Init call).
GetOutgoingFullBytesCountForConnectionReturns how much raw data (in bytes) have been sent from start for connection (from call NetworkTransport.Connect for active connect or from connection request receiving for passive connect).
GetOutgoingFullBytesCountForHostReturns how much raw data (in bytes) have been sent from start for the host (from call NetworkTransport.AddHost).
GetOutgoingMessageCountReturns how many messages have been sent from start (from NetworkTransport.Init call).
GetOutgoingMessageCountForConnectionReturns how many packets have been sent from start for connection (from call NetworkTransport.Connect for active connect or from connection request receiving for passive connect).
GetOutgoingMessageCountForHostReturns how many messages have been sent from start for host (from call NetworkTransport.AddHost).
GetOutgoingMessageQueueSizeReturns the number of messages waiting in the outgoing message queue to be sent.
GetOutgoingPacketCountReturns how many packets have been sent from start (from call NetworkTransport.Init) for all hosts.
GetOutgoingPacketCountForConnectionReturns how many packets have been sent for connection from it start (from call NetworkTransport.Connect for active connect or from connection request receiving for passive connect).
GetOutgoingPacketCountForHostReturns how many packets have been sent for host from it start (from call NetworkTransport.AddHost).
GetOutgoingPacketNetworkLossPercentReturns the value in percent of the number of sent packets that were dropped by the network and not received by the peer.
GetOutgoingPacketOverflowLossPercentReturns the value in percent of the number of sent packets that were dropped by the peer.
GetOutgoingSystemBytesCountReturns how much user payload and protocol system headers (in bytes) have been sent from start (from NetworkTransport.Init call).
GetOutgoingSystemBytesCountForConnectionReturns how much payload and protocol system headers (in bytes) have been sent from start for connection (from call NetworkTransport.Connect for active connect or from connection request receiving for passive connect).
GetOutgoingSystemBytesCountForHostReturns how much payload and protocol system headers (in bytes) have been sent from start for the host (from call NetworkTransport.AddHost).
GetOutgoingUserBytesCountReturns how much payload (user) bytes have been sent from start (from NetworkTransport.Init call).
GetOutgoingUserBytesCountForConnectionReturns how much payload (user) bytes have been sent from start for connection (from call NetworkTransport.Connect for active connect or from connection request receiving for passive connect).
GetOutgoingUserBytesCountForHostReturns how much payload (user) bytes have been sent from start for the host (from call NetworkTransport.AddHost).
GetRemoteDelayTimeMSReturns the delay for the timestamp received.
InitInitializes the NetworkTransport. Should be called before any other operations on the NetworkTransport are done.
IsBroadcastDiscoveryRunningCheck if the broadcast discovery sender is running.
QueueMessageForSendingFunction is queueing but not sending messages.
ReceiveCalled to poll the underlying system for events.
ReceiveFromHostSimilar to NetworkTransport.Receive but will only poll for the provided hostId.
ReceiveRelayEventFromHostPolls the host for the following events: NetworkEventType.ConnectEvent and NetworkEventType.DisconnectEvent. Can only be called by the relay group owner.
RemoveHostCloses the opened socket, and closes all connections belonging to that socket.
SendSend data to peer.
SendMulticastAdd a connection for the multicast send.
SendQueuedMessagesSends messages, previously queued by NetworkTransport.QueueMessageForSending function.
SetBroadcastCredentialsSets the credentials required for receiving broadcast messages. Should any credentials of a received broadcast message not match, the broadcast discovery message is dropped.
SetPacketStatUsed to inform the profiler of network packet statistics.
ShutdownShut down the NetworkTransport.
StartBroadcastDiscoveryStarts sending a broadcasting message in all local subnets.
StartSendMulticastStart to multicast send.
StopBroadcastDiscoveryStop sending the broadcast discovery message.