ENet Class Library for C#

Host.Connect(IPEndPoint, Int32, Int32) Method

Connects to a remote computer at the given address.

[Visual Basic]
Public Overloads Sub Connect( _
   ByVal address As IPEndPoint, _
   ByVal data As Integer, _
   Optional ByVal channelLimit As Integer = 0 _
)
[C#]
public Peer Connect(
   IPEndPoint address,
   int data,
   int channelLimit
);

Parameters

address
The address to connect to.
data
Data to send along with the connect packet.
channelLimit
The maximum number of channels, or 0 to use the maximum possible (255).

Return Value

The new peer. This method does not block: the connection will be established when you receive a Connect event.

Exceptions

Exception Type Condition
ArgumentNullException address is null.
ArgumentException address is not IPv4.
ArgumentOutOfRangeException address's port is less than 0 or greater than 65535, and/or channelLimit is less than 0 or greater than 255.
InvalidOperationException The host is not initialized.
ENetException An error occured.

See Also

Host Class | ENet Namespace | Host.Connect Overload List