:ConnectEx()
Class
Syntax
:ConnectEx(cHost, nPort, [nProtocol], [nTimeout], [nOptions], [cLocalIP], [nLocalPort] ) --> hSession
Parameters
|
cHost |
String, May be a fully-qualified domain name or an IP address. | ||||||
|
nPort |
Numeric, Port that the remote Server is listening on for connections | ||||||
|
nProtocol |
Optional: Numeric, The protocol to be used when establishing the connection.
This may be one of the following values:
| ||||||
|
nTimeout |
Optional: Numeric. Number of Seconds to wait before resulting in a Timeout Error. A Value of zero indicates that the process should wait indefinitely for the Server to respond. | ||||||
|
nOptions |
Numeric constant for socket options (see table below) | ||||||
|
cLocalIP |
Local IP Address in standard dot-notation | ||||||
|
nPort |
Numeric Port number |
Return
If the function succeeds, the return value is a numeric client session value which is stored in :Session.
If the function fails the return value is -1, INET_ERROR. To get further error information see :nErr and :cErr
Description
:Connect() is used to connect to a remote server
Numeric used to specify one or more socket options. The following values are recognized:
|
Constant |
Description |
|
INET_OPTION_BROADCAST |
This option specifies that broadcasting should be enabled for datagrams. This option is invalid for stream sockets. |
|
INET_OPTION_DONTROUTE |
This option specifies default routing should not be used. |
|
INET_OPTION_KEEPALIVE |
This option specifies that packets are to be sent to the remote system when no data is being exchanged to keep the connection active. This is only valid for stream sockets. |
|
INET_OPTION_REUSEADDR |
This option specifies that the local address can be reused. This option is commonly used by server applications. |
|
INET_OPTION_NODELAY |
This option disables the Nagle algorithm, which buffers unacknowledged data and insures that a full-size packet can be sent to the remote host. |
It is not recommend that you disable the Nagle algorithm by specifying the INET_OPTION_NODELAY flag unless it is absolutely required. Doing so can have a significant, negative impact on the performance of the application and network.
When this function is called with UDP as the specified protocol, it does not actually establish a connection. Instead, it simply establishes a default destination IP address and port that is used with subsequent InetRead and InetWrite calls.
See Also