C# Class Lidgren.Network.NetConnection

Datei anzeigen Open project: Fr0sZ/Skylines-Multiplayer Class Usage Examples

Public Methods

Method Description
Approve ( ) : void

Approves this connection; sending a connection response to the remote host

Approve ( NetOutgoingMessage localHail ) : void

Approves this connection; sending a connection response to the remote host

CanSendImmediately ( NetDeliveryMethod method, int sequenceChannel ) : bool
Deny ( ) : void

Denies this connection; disconnecting it

Deny ( string reason ) : void

Denies this connection; disconnecting it

Disconnect ( string byeMessage ) : void

Disconnect from the remote peer

GetLocalTime ( double remoteTimestamp ) : double

Gets local time value comparable to NetTime.Now from a remote value

GetRemoteTime ( double localTimestamp ) : double

Gets the remote time value for a local time value produced by NetTime.Now

GetSendQueueInfo ( NetDeliveryMethod method, int sequenceChannel, int &windowSize, int &freeWindowSlots ) : void

Zero windowSize indicates that the channel is not yet instantiated (used) Negative freeWindowSlots means this amount of messages are currently queued but delayed due to closed window

SendMessage ( NetOutgoingMessage msg, NetDeliveryMethod method, int sequenceChannel ) : NetSendResult

Send a message to this remote connection

ToString ( ) : string

Returns a string that represents this object

Private Methods

Method Description
CreateReceiverChannel ( NetMessageType tp ) : Lidgren.Network.NetReceiverChannelBase
CreateSenderChannel ( NetMessageType tp ) : Lidgren.Network.NetSenderChannelBase
EnqueueMessage ( NetOutgoingMessage msg, NetDeliveryMethod method, int sequenceChannel ) : NetSendResult
ExecuteDisconnect ( string reason, bool sendByeMessage ) : void
ExpandMTU ( double now ) : void
FinalizeMTU ( int size ) : void
GetResendDelay ( ) : float
HandleConnectResponse ( double now, NetMessageType tp, int ptr, int payloadLength ) : void
HandleExpandMTUSuccess ( double now, int size ) : void
Heartbeat ( float now, uint frameCounter ) : void
InitExpandMTU ( double now ) : void
InitializePing ( ) : void
InitializeRemoteTimeOffset ( float remoteSendTime ) : void
MTUExpansionHeartbeat ( double now ) : void
MutateEndPoint ( IPEndPoint endPoint ) : void

Change the internal endpoint to this new one. Used when, during handshake, a switch in port is detected (due to NAT)

NetConnection ( NetPeer peer, IPEndPoint remoteEndPoint ) : System
QueueAck ( NetMessageType tp, int sequenceNumber ) : void
QueueSendMessage ( NetOutgoingMessage om, int seqNr ) : void
ReceivedHandshake ( double now, NetMessageType tp, int ptr, int payloadLength ) : void
ReceivedLibraryMessage ( NetMessageType tp, int ptr, int payloadLength ) : void
ReceivedMessage ( NetIncomingMessage msg ) : void
ReceivedPong ( float now, int pongNumber, float remoteSendTime ) : void
SendConnect ( float now ) : void
SendConnectResponse ( float now, bool onLibraryThread ) : void
SendConnectionEstablished ( ) : void
SendDisconnect ( string reason, bool onLibraryThread ) : void
SendExpandMTU ( double now, int size ) : void
SendMTUSuccess ( int size ) : void
SendPing ( ) : void
SendPong ( int pingNumber ) : void
SetStatus ( NetConnectionStatus status, string reason ) : void
Shutdown ( string reason ) : void
UnconnectedHeartbeat ( float now ) : void
ValidateHandshakeData ( int ptr, int payloadLength, byte &hail ) : bool
WriteLocalHail ( NetOutgoingMessage om ) : void

Method Details

Approve() public method

Approves this connection; sending a connection response to the remote host
public Approve ( ) : void
return void

Approve() public method

Approves this connection; sending a connection response to the remote host
public Approve ( NetOutgoingMessage localHail ) : void
localHail NetOutgoingMessage The local hail message that will be set as RemoteHailMessage on the remote host
return void

CanSendImmediately() public method

public CanSendImmediately ( NetDeliveryMethod method, int sequenceChannel ) : bool
method NetDeliveryMethod
sequenceChannel int
return bool

Deny() public method

Denies this connection; disconnecting it
public Deny ( ) : void
return void

Deny() public method

Denies this connection; disconnecting it
public Deny ( string reason ) : void
reason string The stated reason for the disconnect, readable as a string in the StatusChanged message on the remote host
return void

Disconnect() public method

Disconnect from the remote peer
public Disconnect ( string byeMessage ) : void
byeMessage string the message to send with the disconnect message
return void

GetLocalTime() public method

Gets local time value comparable to NetTime.Now from a remote value
public GetLocalTime ( double remoteTimestamp ) : double
remoteTimestamp double
return double

GetRemoteTime() public method

Gets the remote time value for a local time value produced by NetTime.Now
public GetRemoteTime ( double localTimestamp ) : double
localTimestamp double
return double

GetSendQueueInfo() public method

Zero windowSize indicates that the channel is not yet instantiated (used) Negative freeWindowSlots means this amount of messages are currently queued but delayed due to closed window
public GetSendQueueInfo ( NetDeliveryMethod method, int sequenceChannel, int &windowSize, int &freeWindowSlots ) : void
method NetDeliveryMethod
sequenceChannel int
windowSize int
freeWindowSlots int
return void

SendMessage() public method

Send a message to this remote connection
public SendMessage ( NetOutgoingMessage msg, NetDeliveryMethod method, int sequenceChannel ) : NetSendResult
msg NetOutgoingMessage The message to send
method NetDeliveryMethod How to deliver the message
sequenceChannel int Sequence channel within the delivery method
return NetSendResult

ToString() public method

Returns a string that represents this object
public ToString ( ) : string
return string