TipcConnCreateServer


Name

TipcConnCreateServer — create the server side of a connection

Synopsis

T_IPC_CONN TipcConnCreateServer(logical_conn_name) 
T_STR logical_conn_name; 

Arguments

logical_conn_name — logical connection name to associate with this connection

Return Values

New connection if successful, NULL otherwise.

Diagnostics

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

Description

TipcConnCreateServer creates a server connection that can accept new clients by calling TipcConnAccept. When creating a client/server connection, the server side must always be created first (the client side must have something to connect to). After creating a server connection, TipcConnAccept can be used to accept a new client, and TipcConnCheck can be used to check if a new client is available.

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.

Caution

None

See Also

TipcConnAccept, TipcConnCreateClient; see the TIBCO SmartSockets Utilities for information on TutSocketCreateServer*.

Examples

This example creates a server connection, accepts a new client, and sends a NUMERIC_DATA message to the client:

/* create connection for clients to connect on */ 
server_conn = TipcConnCreateServer("tcp:_node:4242"); 
if (server_conn == NULL) { 
  return;  /* error */ 
}  
 
/* accept connection from client */ 
accept_conn = TipcConnAccept(server_conn); 
if (accept_conn == NULL) { 
  return;  /* error */ 
}  
 
mt = TipcMtLookupByNum(T_MT_NUMERIC_DATA); 
if (mt == NULL) { 
  return;  /* error */ 
}  
 
/* now we can send/recv messages on accept_conn */ 
if (!TipcConnMsgWrite(accept_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