Click or drag to resize

LiteConnectionRequestAcceptIfKey Method

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

Namespace: LiteNetLib
Assembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.2.1.0 (2026.2.1.0)
Syntax
C#
public LiteNetPeer AcceptIfKey(
	string key
)

Parameters

key  String
The required string key to match.

Return Value

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.
See Also