C# 클래스 UnityEngine.Networking.NetworkConnection

A High level network connection. This is used for connections from client-to-server and for connection from server-to-client.

상속: IDisposable
파일 보기 프로젝트 열기: CarlosHBC/UnityDecompiled 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
address string
connectionId int
hostId int
isReady bool
lastMessageTime float
logNetworkMessages bool

Private Properties

프로퍼티 타입 설명
AddOwnedObject void
AddToVisList void
CheckChannel bool
GetPlayerController bool
HandleFragment void
IsReliableQoS bool
IsSequencedQoS bool
LogSend void
OnFragment void
RemoveFromVisList void
RemoveObservers void
RemoveOwnedObject void
RemovePlayerController void
SetHandlers void
SetPlayerController void

공개 메소드들

메소드 설명
CheckHandler ( short msgType ) : bool

This function checks if there is a message handler registered for the message ID.

Disconnect ( ) : void

Disconnects this connection.

Dispose ( ) : void

Disposes of this connection, releasing channel buffers that it holds.

FlushChannels ( ) : void

This causes the channels of the network connection to flush their data to the transport layer.

GetStatsIn ( int &numMsgs, int &numBytes ) : void
GetStatsOut ( int &numMsgs, int &numBufferedMsgs, int &numBytes, int &lastBufferedPerSecond ) : void
Initialize ( string networkAddress, int networkHostId, int networkConnectionId, HostTopology hostTopology ) : void

This inializes the internal data structures of a NetworkConnection object, including channel buffers.

InvokeHandler ( NetworkMessage netMsg ) : bool

This function invokes the registered handler function for a message.

InvokeHandler ( short msgType, NetworkReader reader, int channelId ) : bool

This function invokes the registered handler function for a message.

InvokeHandlerNoData ( short msgType ) : bool

This function invokes the registered handler function for a message, without any message data.

RegisterHandler ( short msgType, NetworkMessageDelegate handler ) : void

This registers a handler function for a message Id.

ResetStats ( ) : void

Resets the statistics that are returned from NetworkClient.GetConnectionStats().

Send ( short msgType, MessageBase msg ) : bool

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

SendByChannel ( short msgType, MessageBase msg, int channelId ) : bool

This sends a network message on the connection using a specific transport layer channel.

SendBytes ( byte bytes, int numBytes, int channelId ) : bool

This sends an array of bytes on the connection.

SendUnreliable ( short msgType, MessageBase msg ) : bool

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

SendWriter ( NetworkWriter writer, int channelId ) : bool

This sends the contents of a NetworkWriter object on the connection.

SetChannelOption ( int channelId, ChannelOption option, int value ) : bool

This sets an option on the network channel.

SetMaxDelay ( float seconds ) : void

The maximum time in seconds that messages are buffered before being sent.

ToString ( ) : string

Returns a string representation of the NetworkConnection object state.

TransportRecieve ( byte bytes, int numBytes, int channelId ) : void

This virtual function allows custom network connection classes to process data from the network before it is passed to the application.

TransportSend ( byte bytes, int numBytes, int channelId, byte &error ) : bool
UnregisterHandler ( short msgType ) : void

This removes the handler registered for a message Id.

보호된 메소드들

메소드 설명
Dispose ( bool disposing ) : void
HandleBytes ( byte buffer, int receivedSize, int channelId ) : void

This makes the connection process the data contained in the buffer, and call handler functions.

HandleReader ( NetworkReader reader, int receivedSize, int channelId ) : void

This makes the connection process the data contained in the stream, and call handler functions.

비공개 메소드들

메소드 설명
AddOwnedObject ( NetworkIdentity obj ) : void
AddToVisList ( NetworkIdentity uv ) : void
CheckChannel ( int channelId ) : bool
GetPlayerController ( short playerControllerId, PlayerController &playerController ) : bool
HandleFragment ( NetworkReader reader, int channelId ) : void
IsReliableQoS ( QosType qos ) : bool
IsSequencedQoS ( QosType qos ) : bool
LogSend ( byte bytes ) : void
OnFragment ( NetworkMessage netMsg ) : void
RemoveFromVisList ( NetworkIdentity uv, bool isDestroyed ) : void
RemoveObservers ( ) : void
RemoveOwnedObject ( NetworkIdentity obj ) : void
RemovePlayerController ( short playerControllerId ) : void
SetHandlers ( NetworkMessageHandlers handlers ) : void
SetPlayerController ( PlayerController player ) : void

메소드 상세

CheckHandler() 공개 메소드

This function checks if there is a message handler registered for the message ID.

public CheckHandler ( short msgType ) : bool
msgType short The message ID of the handler to look for.
리턴 bool

Disconnect() 공개 메소드

Disconnects this connection.

public Disconnect ( ) : void
리턴 void

Dispose() 공개 메소드

Disposes of this connection, releasing channel buffers that it holds.

public Dispose ( ) : void
리턴 void

Dispose() 보호된 메소드

protected Dispose ( bool disposing ) : void
disposing bool
리턴 void

FlushChannels() 공개 메소드

This causes the channels of the network connection to flush their data to the transport layer.

public FlushChannels ( ) : void
리턴 void

GetStatsIn() 공개 메소드

public GetStatsIn ( int &numMsgs, int &numBytes ) : void
numMsgs int
numBytes int
리턴 void

GetStatsOut() 공개 메소드

public GetStatsOut ( int &numMsgs, int &numBufferedMsgs, int &numBytes, int &lastBufferedPerSecond ) : void
numMsgs int
numBufferedMsgs int
numBytes int
lastBufferedPerSecond int
리턴 void

HandleBytes() 보호된 메소드

This makes the connection process the data contained in the buffer, and call handler functions.

protected HandleBytes ( byte buffer, int receivedSize, int channelId ) : void
buffer byte Data to process.
receivedSize int Size of the data to process.
channelId int Channel the data was recieved on.
리턴 void

HandleReader() 보호된 메소드

This makes the connection process the data contained in the stream, and call handler functions.

protected HandleReader ( NetworkReader reader, int receivedSize, int channelId ) : void
reader NetworkReader Stream that contains data.
receivedSize int Size of the data.
channelId int Channel the data was received on.
리턴 void

Initialize() 공개 메소드

This inializes the internal data structures of a NetworkConnection object, including channel buffers.

public Initialize ( string networkAddress, int networkHostId, int networkConnectionId, HostTopology hostTopology ) : void
networkAddress string The host or IP connected to.
networkHostId int The transport hostId for the connection.
networkConnectionId int The transport connectionId for the connection.
hostTopology HostTopology The topology to be used.
리턴 void

InvokeHandler() 공개 메소드

This function invokes the registered handler function for a message.

public InvokeHandler ( NetworkMessage netMsg ) : bool
netMsg NetworkMessage The message object to process.
리턴 bool

InvokeHandler() 공개 메소드

This function invokes the registered handler function for a message.

public InvokeHandler ( short msgType, NetworkReader reader, int channelId ) : bool
msgType short The message type of the handler to use.
reader NetworkReader The stream to read the contents of the message from.
channelId int The channel that the message arrived on.
리턴 bool

InvokeHandlerNoData() 공개 메소드

This function invokes the registered handler function for a message, without any message data.

public InvokeHandlerNoData ( short msgType ) : bool
msgType short The message ID of the handler to invoke.
리턴 bool

RegisterHandler() 공개 메소드

This registers a handler function for a message Id.

public RegisterHandler ( short msgType, NetworkMessageDelegate handler ) : void
msgType short The message ID to register.
handler NetworkMessageDelegate The handler function to register.
리턴 void

ResetStats() 공개 메소드

Resets the statistics that are returned from NetworkClient.GetConnectionStats().

public ResetStats ( ) : void
리턴 void

Send() 공개 메소드

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

public Send ( short msgType, MessageBase msg ) : bool
msgType short The ID of the message to send.
msg MessageBase The message to send.
리턴 bool

SendByChannel() 공개 메소드

This sends a network message on the connection using a specific transport layer channel.

public SendByChannel ( short msgType, MessageBase msg, int channelId ) : bool
msgType short The message ID to send.
msg MessageBase The message to send.
channelId int The transport layer channel to send on.
리턴 bool

SendBytes() 공개 메소드

This sends an array of bytes on the connection.

public SendBytes ( byte bytes, int numBytes, int channelId ) : bool
bytes byte The array of data to be sent.
numBytes int The number of bytes in the array to be sent.
channelId int The transport channel to send on.
리턴 bool

SendUnreliable() 공개 메소드

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

public SendUnreliable ( short msgType, MessageBase msg ) : bool
msgType short The message ID to send.
msg MessageBase The message to send.
리턴 bool

SendWriter() 공개 메소드

This sends the contents of a NetworkWriter object on the connection.

public SendWriter ( NetworkWriter writer, int channelId ) : bool
writer NetworkWriter A writer object containing data to send.
channelId int The transport channel to send on.
리턴 bool

SetChannelOption() 공개 메소드

This sets an option on the network channel.

public SetChannelOption ( int channelId, ChannelOption option, int value ) : bool
channelId int The channel the option will be set on.
option ChannelOption The option to set.
value int The value for the option.
리턴 bool

SetMaxDelay() 공개 메소드

The maximum time in seconds that messages are buffered before being sent.

public SetMaxDelay ( float seconds ) : void
seconds float Time in seconds.
리턴 void

ToString() 공개 메소드

Returns a string representation of the NetworkConnection object state.

public ToString ( ) : string
리턴 string

TransportRecieve() 공개 메소드

This virtual function allows custom network connection classes to process data from the network before it is passed to the application.

public TransportRecieve ( byte bytes, int numBytes, int channelId ) : void
bytes byte The data recieved.
numBytes int The size of the data recieved.
channelId int The channel that the data was received on.
리턴 void

TransportSend() 공개 메소드

public TransportSend ( byte bytes, int numBytes, int channelId, byte &error ) : bool
bytes byte
numBytes int
channelId int
error byte
리턴 bool

UnregisterHandler() 공개 메소드

This removes the handler registered for a message Id.

public UnregisterHandler ( short msgType ) : void
msgType short The message ID to unregister.
리턴 void

프로퍼티 상세

address 공개적으로 프로퍼티

The IP address associated with the connection.

public string address
리턴 string

connectionId 공개적으로 프로퍼티

Unique identifier for this connection that is assigned by the transport layer.

public int connectionId
리턴 int

hostId 공개적으로 프로퍼티

Transport level host ID for this connection.

public int hostId
리턴 int

isReady 공개적으로 프로퍼티

Flag that tells if the connection has been marked as "ready" by a client calling ClientScene.Ready().

public bool isReady
리턴 bool

lastMessageTime 공개적으로 프로퍼티

The last time that a message was received on this connection.

public float lastMessageTime
리턴 float

logNetworkMessages 공개적으로 프로퍼티

Setting this to true will log the contents of network message to the console.

public bool logNetworkMessages
리턴 bool