ct_con_alloc

Description

Allocate a CS_CONNECTION structure.

Syntax

CS_RETCODE ct_con_alloc(context, con_pointer)
 
 CS_CONTEXT          *context;
 CS_CONNECTION     **con_pointer;

Parameters

context

A pointer to a CS_CONTEXT structure.

con_pointer

The address of a pointer variable. ct_con_alloc sets *con_pointer to the address of a newly allocated CS_CONNECTION structure.

Returns

ct_con_alloc returns the following values:

Return value

Meaning

CS_SUCCEED

The routine completed successfully

CS_FAIL

The routine failed

The most common reason for a ct_con_alloc failure is a lack of adequate memory.

Examples

Example 1

        /*
         ** DoConnect()
         **
         ** Type of function:
         ** async example program api
         */
         CS_STATIC CS_CONNECTION CS_INTERNAL *
         DoConnect(argc, argv)
         int      argc;
         char     **argv;
         {
             CS_CONNECTION   *connection;
             CS_INT          netio_type = CS_ASYNC_IO;
             CS_RETCODE      retcode;
            /* Open a connection to the server */
             retcode = ct_con_alloc(Ex_context, &connection);
             if (retcode != CS_SUCCEED)
             {
                 ex_panic("ct_con_alloc failed");
             }
            /* Set properties for the connection */
             ...ct_con_props calls deleted ...
            /* Open the connection */
             ...ct_connect call deleted.....
         }

Usage

See also

cs_ctx_alloc, ct_cmd_alloc, ct_close, ct_connect, ct_con_props