TipcConnMsgSend


Name

TipcConnMsgSend — send a message through a connection

Synopsis

T_BOOL TipcConnMsgSend(conn, msg) 
T_IPC_CONN conn; 
T_IPC_MSG msg; 

Arguments

conn — connection to send message through

msg — message to be sent

Return Values

TRUE if message was successfully sent, FALSE otherwise.

Diagnostics

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

Description

TipcConnMsgSend sends a message through a connection. The connection’s write callbacks are first called for the message.

If the message has a delivery mode of either T_IPC_DELIVERY_SOME or T_IPC_DELIVERY_ALL, then TipcConnMsgSend performs some extra steps for guaranteed message delivery. If the connection does not have a GMD area open, then TipcConnMsgSend calls TipcConnGmdFileCreate to create the necessary GMD area. TipcConnMsgSend increments an internal per-connection sequence number, sets the sequence number of the message to the incremented value, and then saves a copy of the message to the GMD area so that the message can be easily resent. With file-based GMD, recovery can take place even if this process crashes and has to be restarted. See TipcConnGmdFileCreate for more information on creation of GMD areas. If the message delivery timeout property is not set, then the connection delivery timeout value is used for GMD.

TipcConnMsgSend then converts the message into a message packet (checking the message header string encode property to see if header strings should be encoded as integers to save space), and appends the message packet to the connection’s write buffer. TipcConnMsgSend then calls TipcConnFlush if the number of bytes in the connection’s write buffer is greater than the connection’s auto flush size.

Caution

TipcConnMsgSend does not set the sender property or destination property of the message.

Use TipcSrvMsgSend or TipcSrvConnMsgSend, not TipcConnMsgSend, to send messages to RTserver.

If TipcConnGmdFileCreate fails to create a file-based GMD area, a warning similar to this is output with TutWarning:

WARNING: Could not create GMD file(s) with base name 
<local_node_test> 
for connection <client:local:_node:test>. 
The option Unique_Subject must be set to a value other 
than the default (_workstation1_8668). 
Switching to memory-only GMD. 

If the above warning appears, the process is not configured properly to use file-based GMD. See TipcConnGmdFileCreate for more information on creating GMD areas.

See Also

TipcConnFlush, TipcConnMsgWrite, TipcConnRead, TipcSrvMsgSend, TipcSrvConnMsgSend

Examples

This example creates a message, appends fields, and sends the message with TipcConnMsgSend:

mt = TipcMtLookupByNum(T_MT_INFO); 
if (mt == NULL) { 
  return;  /* error */ 
} 
 
msg = TipcMsgCreate(mt); 
if (msg == NULL) { 
  return;  /* error */ 
} 
 
if (!TipcMsgAppendStr(msg, "Open the pod bay doors, Hal")) { 
  return;  /* error */ 
}  
 
/*  
Normally the message sender and destination would be set here. 
The sender/destination are very connection-specific. 
*/ 
 
/* send the message */ 
if (!TipcConnMsgSend(conn, msg)) { 
  return;  /* error */ 
} 
if (!TipcMsgDestroy(msg)) { 
    return;  /* error */ 
} 

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