Skip to content

Class Lidgren::Network::NetConnection

ClassList > Lidgren > Network > NetConnection

Represents a connection to a remote peer.

Public Properties

Type Name
property float AverageRoundtripTime
Gets the current average roundtrip time in seconds.
property int CurrentMTU
Gets the current MTU in bytes. If PeerConfiguration.AutoExpandMTU is false, this will be PeerConfiguration.MaximumTransmissionUnit.
property NetOutgoingMessage LocalHailMessage
Gets the local hail message that was sent as part of the handshake.
property NetPeer Peer
Gets the peer which holds this connection.
property NetEndPoint RemoteEndPoint
Gets the remote endpoint for the connection.
property NetIncomingMessage RemoteHailMessage
The message that the remote part specified via Connect() or Approve() - can be null.
property float RemoteTimeOffset
Time offset between this peer and the remote peer.
property long RemoteUniqueIdentifier
Gets the unique identifier of the remote NetPeer for this connection.
property NetConnectionStatistics Statistics
Gets various statistics for this connection.
property NetConnectionStatus Status
Gets the current status of the connection (synced to the last status message read)
property object Tag
Gets or sets the application defined object containing data about the connection.

Public Functions

Type Name
void Approve ()
Approves this connection; sending a connection response to the remote host.
void Approve (NetOutgoingMessage localHail)
Approves this connection; sending a connection response to the remote host.
bool CanSendImmediately (NetDeliveryMethod method, int sequenceChannel)
void Deny ()
Denies this connection; disconnecting it.
void Deny (string reason)
Denies this connection; disconnecting it.
void Disconnect (string byeMessage)
Disconnect from the remote peer.
double GetLocalTime (double remoteTimestamp)
Gets local time value comparable to NetTime.Now from a remote value.
double GetRemoteTime (double localTimestamp)
Gets the remote time value for a local time value produced by NetTime.Now.
void GetSendQueueInfo (NetDeliveryMethod method, int sequenceChannel, out int windowSize, out int freeWindowSlots)
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.
NetSendResult SendMessage (NetOutgoingMessage msg, NetDeliveryMethod method, int sequenceChannel)
Send a message to this remote connection.
override string ToString ()
Returns a string that represents this object.

Public Properties Documentation

property AverageRoundtripTime

float Lidgren.Network.NetConnection.AverageRoundtripTime;

property CurrentMTU

int Lidgren.Network.NetConnection.CurrentMTU;

property LocalHailMessage

NetOutgoingMessage Lidgren.Network.NetConnection.LocalHailMessage;

property Peer

NetPeer Lidgren.Network.NetConnection.Peer;

property RemoteEndPoint

NetEndPoint Lidgren.Network.NetConnection.RemoteEndPoint;

property RemoteHailMessage

NetIncomingMessage Lidgren.Network.NetConnection.RemoteHailMessage;

property RemoteTimeOffset

float Lidgren.Network.NetConnection.RemoteTimeOffset;

property RemoteUniqueIdentifier

long Lidgren.Network.NetConnection.RemoteUniqueIdentifier;

property Statistics

NetConnectionStatistics Lidgren.Network.NetConnection.Statistics;

property Status

NetConnectionStatus Lidgren.Network.NetConnection.Status;

property Tag

object Lidgren.Network.NetConnection.Tag;

Public Functions Documentation

function Approve [1/2]

inline void Lidgren::Network::NetConnection::Approve () 

function Approve [2/2]

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

inline void Lidgren::Network::NetConnection::Approve (
    NetOutgoingMessage localHail
) 

Parameters:

  • localHail The local hail message that will be set as RemoteHailMessage on the remote host

function CanSendImmediately

inline bool Lidgren::Network::NetConnection::CanSendImmediately (
    NetDeliveryMethod method,
    int sequenceChannel
) 

function Deny [1/2]

inline void Lidgren::Network::NetConnection::Deny () 

function Deny [2/2]

Denies this connection; disconnecting it.

inline void Lidgren::Network::NetConnection::Deny (
    string reason
) 

Parameters:

  • reason The stated reason for the disconnect, readable as a string in the StatusChanged message on the remote host

function Disconnect

Disconnect from the remote peer.

inline void Lidgren::Network::NetConnection::Disconnect (
    string byeMessage
) 

Parameters:

  • byeMessage the message to send with the disconnect message

function GetLocalTime

inline double Lidgren::Network::NetConnection::GetLocalTime (
    double remoteTimestamp
) 

function GetRemoteTime

inline double Lidgren::Network::NetConnection::GetRemoteTime (
    double localTimestamp
) 

function GetSendQueueInfo

inline void Lidgren::Network::NetConnection::GetSendQueueInfo (
    NetDeliveryMethod method,
    int sequenceChannel,
    out int windowSize,
    out int freeWindowSlots
) 

function SendMessage

Send a message to this remote connection.

inline NetSendResult Lidgren::Network::NetConnection::SendMessage (
    NetOutgoingMessage msg,
    NetDeliveryMethod method,
    int sequenceChannel
) 

Parameters:

  • msg The message to send
  • method How to deliver the message
  • sequenceChannel Sequence channel within the delivery method

function ToString

inline override string Lidgren::Network::NetConnection::ToString () 

The documentation for this class was generated from the following file api/unity-plugin/Scripts/Networking/Lidgren.Network/NetConnection.cs