Connects a socket to the specified TCP/IP port on the specified host.

Return type: LOGICAL

Applies to: Socket object handle

Syntax

CONNECT ( [ connection-parms ] )
connection-parms
A character string expression that contains a space-separated list of one or more socket connection parameters.

The following table describes each socket connection parameter, which can be included in this string.

Table 1. Socket connection parameters
Parameter Description
-clientConnectTimeout nMilliseconds Optional. The number of milliseconds to wait before timing out each connection attempt.
-H socket-address Optional. The host name or IP address to which the connection is to be established.
-nohostverify If specified, turns off host verification for a TLS-enabled connection to a server socket. Without this parameter specified, the client compares the host name specified in the connection with the Common Name specified in the server certificate, and raises an error if they do not match. With this parameter specified, the client never raises the error. For more information, see Learn about Security and Auditing.
-nosessionreuse If specified, the connection does not reuse the TLS session ID when reconnecting to the same TLS-enabled server socket.
Note: OpenEdge TLS turns on TLS session reuse by default. So, after the initial connection to a given host (-H) and port (-S), each subsequent connection to the same host and port restarts the TLS session and ignores any different connection parameters that are specified for the subsequent connection, including -nosessionreuse. If you want to change TLS socket options (such as -nohostverify) for each subsequent connection to a given host and port, be sure to specify the -nosessionreuse parameter on the initial TLS socket connection to that same host and port.
-pf filename Optional. A text file containing any of the socket connection parameters described in this table. If this file contains any other OpenEdge startup parameters, this method ignores them.
-S socket-port The port number for the socket connection. You can specify either an explicit port number or a TCP service name. If you use a TCP service name, the method uses the port number associated with that name in the TCP/IP services file.
-ssl If specified, the connection to the server socket uses Transport Layer Security (TLS) tunneling.

(Used in conjunction with the -H and -S parameters.)

Note: Be sure you need TLS before using this option. TLS incurs more or less heavy performance penalties, depending on resources and load.
-sslAuth Authentication-type Specifies if access to an OpenEdge and Non-OpenEdge server requires TLS client authentication.
The two authentication types are:
  1. ssl—Enables client authentication for OpenEdge and Non-OpenEdge server access.
  2. basic— In this authentication type, the connect method ignores the client authentication for OpenEdge and Non-OpenEdge server access.
-sslciphers SSL-protocol-ciphers Optional. A comma-separated list of cryptographic ciphers the client is willing to accept.
-sslKeyFile filename | target-database The location of the client certificate.

If you do not specify an absolute path of the client certificate file, the connection operation searches the $DLC/keys folder for the client-certificate-file-name.pem file. This option must be set only if -sslAuth parameter is set to ssl.

-sslKeyPwd password The TLS client certificate password in cleartext or in encoded format.

For more information on encoded format, see Use genpassword to obtain a keystore password-encoded value in Manage OpenEdge Keys and Certificates.

-sslprotocols SSL-protocol-names Optional. A comma-separated list of cryptographic protocols the client is willing to accept.
Note: Connections to a TLS-enabled server socket require the management of public keys on the client (TLS client) and private keys on the server (TLS server). For ABL sockets, the TLS client is the ABL session initiating the TLS connection on a socket object and the TLS server is the ABL session enabling TLS connections on a server socket object. For information on using TLS to secure an ABL socket connection, see the sections on sockets in OpenEdge Programming Interfaces. For more information on TLS and managing private key and digital certificate stores for OpenEdge TLS clients and servers, see Learn about Security and Auditing.

If an error occurs while executing the CONNECT() method, the method returns FALSE. Otherwise, it returns TRUE.

When an ABL client (that is not TLS-enabled) calls the CONNECT() method and immediately reads data from the socket using the READ() method, and an ABL server (that is TLS-enabled) calls the ENABLE-CONNECTIONS() method and immediately writes data to the socket using the WRITE() method, a deadlock condition can occur. That is, the client is waiting for the server to send data, and the server (regardless of the Write operation) is waiting for the client connection to send data that starts the TLS connection.