mnConnect

This initializes an instance to client state and is used to connect to a server.

Note that you cannot connect to one server via UDP, and another server via TCP in a single mnConnect command. The address information must be for only one server.

See mnPollConnect for pseudo code demonstrating how to use this command when Block_until_connect is set to false.

Parameters

int Instance: This is the instance that the command should use.

const char *: TCP_IP_to_connect_to: This is the IP address to connect to via TCP.

unsigned short TCP_Port_to_connect_to: This is the port of the server that you want to connect to via TCP; the local port of the server is set on the server side using the mnSetLocal command.

const char * UDP_IP_to_connect_to: This is the IP address to connect to via UDP.

unsigned short UDP_Port_to_connect_to: This is the port of the server that you want to connect to via UDP.

int Timeout_in_seconds: This is the length of time in seconds that the command will wait for the connection to complete before giving up.

bool Block_until_connected: If this is true then the command will return after the timeout has expired or the connection has completed. If this is false then the command will return without blocking and you can use mnPollConnect and mnStopConnect to manage the connection process.

Returns (Integer)

If Block_until_connected is true:

1 if the connection was successful

0 if the connection timed out

-1 if an error occurred during connection

-2 if the connection request was rejected, usually because the server was full

If Block_until_connected is false:

0 if no error occurred

-1 if an error occurred during connection

Present in

DBP

C++

.Net




This page is in the following sections:
(2) Networking Commands
(1) Networking
(0) DarkNet Help