cp_socket

Section: cp_client (3)
Updated: MARCH 2006
Index Return to Main Contents
 

NAME

cp_client_connect - establish a tcp connection  

SYNOPSIS

#include <cprops/client.h>

int cp_client_connect(cp_client *client);  

DESCRIPTION

cp_client_connect attempts to establish the connection described by a cp_client created with cp_client_create or cp_client_create_ssl. By default as many as three retries may be made. This value may be set by calling cp_client_set_retry.

For ssl sockets, once the tcp connection is established, an ssl handshake will be attempted and the server certificate will be verified on success. On verification failure the connection will fail or succeed depending on the verification mode requested when creating the cp_client structure. The certificate presented by the server in the ssl handshake process may be retrieved and examined by calling cp_client_get_server_certificate.

cp_client_verify_hostname may be used to check whether the host name given in the server certificate matches the host name used for the connection.

Successful calls to cp_client_connect should be matched with a call to cp_client_close once the communication is done.  

RETURN VALUE

cp_client_connect returns zero on success or -1 on failure. cp_client_connect_ssl returns zero on success, -1 on failure or a positive number indicating a verification error if the ssl handshake succeeds but the server certificate does not verify. Positive return codes match the description for the openssl command line utility verify(1), with the added semantic of X509_V_ERR_APPLICATION_VERIFICATION possibly indicating that no server certificate was presented.  

SEE ALSO

cp_client_set_retry(3), cp_client_get_server_certificate(3), cp_client_verify_hostname(3), cp_client_set_retry(3), cp_client_close(3) verify(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 14:33:55 GMT, March 14, 2006
SourceForge.net Logo