Show / Hide Table of Contents

Class LiteConnectionRequest

Inheritance
object
LiteConnectionRequest
ConnectionRequest
Namespace: LiteNetLib
Assembly: LiteNetLib.dll
Syntax
public class LiteConnectionRequest

Fields

RemoteEndPoint

The remote endpoint (IP and Port) of the peer requesting the connection.

Declaration
public readonly IPEndPoint RemoteEndPoint
Field Value
Type Description
IPEndPoint

Properties

Data

Data sent by the remote peer in the connection request.

Declaration
public NetDataReader Data { get; }
Property Value
Type Description
NetDataReader

Methods

Accept()

Accept connection and get new NetPeer as result

Declaration
public LiteNetPeer Accept()
Returns
Type Description
LiteNetPeer

Connected NetPeer

AcceptIfKey(string)

Accepts the connection if the first string in the Data matches the provided key.

Declaration
public LiteNetPeer AcceptIfKey(string key)
Parameters
Type Name Description
string key

The required string key to match.

Returns
Type Description
LiteNetPeer

A new LiteNetPeer if the key matches and connection is accepted; otherwise, null.

Remarks

This is a helper method for simple password/key validation. If the key does not match or data is invalid, the connection is automatically rejected.

Reject()

Rejects the connection reliably without additional data.

Declaration
public void Reject()

Reject(NetDataWriter)

Rejects the connection reliably using data from a NetDataWriter.

Declaration
public void Reject(NetDataWriter rejectData)
Parameters
Type Name Description
NetDataWriter rejectData

Writer containing the data to send.

Reject(byte[])

Rejects the connection reliably.

Declaration
public void Reject(byte[] rejectData)
Parameters
Type Name Description
byte[] rejectData

Data to send with the rejection.

Reject(byte[], int, int)

Rejects the connection reliably. Creates a temporary peer to handle packet loss.

Declaration
public void Reject(byte[] rejectData, int start, int length)
Parameters
Type Name Description
byte[] rejectData

Data to send with the rejection.

int start

Offset in the rejectData array.

int length

Length of the data to be sent.

Reject(byte[], int, int, bool)

Rejects the connection request.

Declaration
public void Reject(byte[] rejectData, int start, int length, bool force)
Parameters
Type Name Description
byte[] rejectData

Optional user data to send along with the rejection packet.

int start

Offset in the rejectData array.

int length

Length of the data to be sent from the rejectData array.

bool force

If true, immediately removes the request, if rejectData is not null a reject packet is also sent.
If false, creates a temporary peer that sends rejection packets and lingers in memory until a timeout occurs to handle late-arriving packets.

RejectForce()

Rejects the connection immediately without sending any packet.

Declaration
public void RejectForce()

RejectForce(NetDataWriter)

Rejects the connection immediately without reliability using data from a NetDataWriter.

Declaration
public void RejectForce(NetDataWriter rejectData)
Parameters
Type Name Description
NetDataWriter rejectData

Writer containing the data to send.

RejectForce(byte[])

Rejects the connection immediately without reliability.

Declaration
public void RejectForce(byte[] rejectData)
Parameters
Type Name Description
byte[] rejectData

Data to send with the rejection.

RejectForce(byte[], int, int)

Rejects the connection immediately without reliability. Minimizes resource usage by not creating an internal peer.

Declaration
public void RejectForce(byte[] rejectData, int start, int length)
Parameters
Type Name Description
byte[] rejectData

Data to send with the rejection.

int start

Offset in the rejectData array.

int length

Length of the data to be sent.

In this article
Back to top Generated by DocFX