Creates a connection.
DWORD ppxCreateConnection ( CTAHD ctahd, char *name, PPX_HANDLE_PARMS *parms, PPXHD *ppxhd )
|
Argument |
Description |
|
ctahd |
Context handle returned by ctaCreateContext or ctaAttachContext. |
|
name |
Pointer to a connection name, or NULL value. |
|
parms |
Pointer to a PPX_HANDLE_PARMS structure. The structure is defined as follows: typedef struct Set reservation_key field to NULL. This field is not used. |
|
ppxhd |
Pointer to connection handle. |
|
Return value |
Description |
|
SUCCESS |
|
|
CTAERR_OUT_OF_MEMORY |
Unable to allocate memory. |
|
CTAERR_SVR_COMM |
Natural Access server communication error. |
|
PPXERR_COMM_FAILURE |
Problems were encountered when communicating with the PPX server. |
|
PPXERR_CONNECTION_ALREADY_EXISTS |
A connection already exists in the PPX connection database with the specified name. |
ppxCreateConnection creates a connection and returns a handle to it. Initially, the connection has no talkers or listeners attached to it.
A default pattern is specified when the connection is created. All listeners added to the connection receive the default pattern if there is no talker attached. If a default pattern is not specified in the call to ppxCreateConnection, the default pattern is set to 0x7f (mu-law), unless otherwise specified by the IdleCode switching fabric attribute within the PPX configuration file.
A name can also be specified when creating the connection. A name is required to access the connection across applications using ppxOpenConnection. Named connections persist when the client exits.
Refer to Creating a connection for more information.
void WhileTheyWait( MYCONTEXT *cx )
{
DWORD e;
char ppxname [20];
DemoStartProtocol( cx->hd, cx->protocol, NULL, NULL );
/* Allocate a connection */
sprintf( ppxname, "ppxdemo%01d", cx->id );
e = ppxCreateConnection( cx->hd, ppxname, &ppx_parms,
&(ppxhd[cx->id]) );
if (e != SUCCESS)
{
printf("Unable to create a connection ; returns: %d\n",e);
exit(-1);
}
}