Class ConnectionRequest
Inherited Members
Namespace: LiteNetLib
Assembly: LiteNetLib.dll
Syntax
public class ConnectionRequest : LiteConnectionRequest
Methods
Accept()
Accept connection and get new NetPeer as result
Declaration
public NetPeer Accept()
Returns
| Type | Description |
|---|---|
| NetPeer | Connected NetPeer |
AcceptIfKey(string)
Accepts the connection if the first string in the Data matches the provided key.
Declaration
public NetPeer AcceptIfKey(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The required string key to match. |
Returns
| Type | Description |
|---|---|
| NetPeer | A new LiteNetPeer if the key matches and connection is accepted; otherwise, |
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.