Products Downloads


French version


 


This function allows you to connect to a TCP/IP server by specifying connection options.


Context

  • Windows client,

  • Windows server,

  • Java client,

  • Java server,

  • Adelia Web client,

  • Adelia Cloud client,

  • Event Adelia client.


Parameters

ALPHA(n)

Server

Host name or IP address of the server.

NUM_BIN_4

Port

Server's port number

ALPHA(n) Options

Options.

List of "option=value" pairs, separated with ';' characters. The possible options are described later.

connect_timeout milliseconds Connection timeout in milliseconds, zero by default*.
so_timeout milliseconds Read timeout in milliseconds, zero by default. Applies to VaToolBxSockRecvXXXX functions.
tcp_nodelay 0/1 Disables Nagle's algorithm on the socket. Disabled by default.
keepalive 0/1 Triggers the sending of "keepalive" packets to keep the connection open during a period of inactivity.

NUM_BIN_4

Socket

Socket handle.

NUM_BIN_4

ReturnCode

Operation return code:

0          Operation completed successfully

Other   Specific error code


* NB: the connection timeout cannot exceed the default value set at system level. In the Windows version, if the connection fails using the default IPV4, the runtime retries using IPV6. The effective timeout is therefore twice the indicated value. The timeout only applies to the connection. An additional (non-configurable) time can apply if DNS name resolution fails.


Example

ALPHA(128) Host
NUM_BIN_4 Port
ALPHA(128) Options
NUM_BIN_4 Socket
NUM_BIN_4 Rc

* Connection with a 5 seconds timeout

Server = 'host.domain.com'

Port    = 10000

Options = 'connect_timeout=5000'


CALL_DLL 'VATOOLBX.DLL' 'VaToolBxSockConnectTcpServerEx' Host Port Options Socket Rc


IF Rc = 0

   * connection established

   ...



List of the VaToolBx functions by topic


↑ Top of page

  • Aucune étiquette