TipcConnCreateClient


Name

TipcConnCreateClient — create the client side of a connection

Synopsis

T_IPC_CONN TipcConnCreateClient(logical_conn_name) 
T_STR logical_conn_name; 

Arguments

logical_conn_name — logical connection name that the server process is using

Return Values

New connection if successful, NULL otherwise.

Diagnostics

If TipcConnCreateClient fails, it returns NULL and sets the global SmartSockets error number to one of:

Description

TipcConnCreateClient creates a client connection and connects to a server connection (which must have already been created). When creating a client/server connection, the server side must always be created first. The client side must have something to connect to.

SmartSockets simplifies the creation of connections with logical connection names that are specified consistently for all protocols. A server process uses a logical connection name to create a server connection, and a client process uses the same logical connection name to create a client connection to the server process. Each logical connection name has the form protocol:node:address. For the client process to find the server process, the logical connection name used by the client must exactly match the logical connection name used by the server. (For example, the name tcp:workstation1:1234 does not match the name tcp:workstation2:1234.)

See the TIBCO SmartSockets User’s Guide for more details on logical connection names.

TipcConnCreateClient also sets the size of the new connection’s socket send and receive buffers to 48K bytes with the function setsockopt.

Caution

None

See Also

TipcConnCreateServer. See the TIBCO SmartSockets Utilities for information on TutSocketCreateClient*.

Examples

This example connects to a server connection on the same node and sends a NUMERIC_DATA message to the server:

/* create connection to server */ 
conn = TipcConnCreateClient("tcp:_node:4242"); 
if (conn == NULL) { 
  return;  /* error */ 
}  
 
mt = TipcMtLookupByNum(T_MT_NUMERIC_DATA); 
if (mt == NULL) { 
  return;  /* error */ 
}  
 
/* now we can send/recv messages on connection */ 
if (!TipcConnMsgWrite(conn, mt, 
                      T_IPC_FT_STR, "speed_limit", 
                      T_IPC_FT_REAL8, 55.0, 
                      NULL)) { 
  return;  /* error */ 
}  

TIBCO SmartSockets™ Application Programming Interface
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com