Sending messages with GMD is very easy. The message delivery mode must first be set to T_IPC_DELIVERY_ALL or T_IPC_DELIVERY_SOME, and then the message can be sent as usual with TipcConnMsgSend. For example:
if (!TipcMsgSetDeliveryMode(msg, T_IPC_DELIVERY_ALL)) {/* error */
} if (!TipcConnMsgSend(conn, msg)) {/* error */
}
TipcConnMsgSend automatically calls TipcConnGmdFileCreate if necessary. For GMD, TipcConnMsgSend increments an internal per-connection outgoing sequence number, sets the message sequence number to the incremented value, saves a copy of the message in the connection GMD area, and saves the current wall clock time in the GMD area (for detecting a delivery timeout). Note that the message sequence number is set after the connection write callbacks are called, as illustrated by this output from the example client program (the sequence number is zero in the write callback):
Constructing and sending an INFO message. write: type info, seq_num 0 INFO field: GMD test #1 Send another INFO message with GMD. write: type info, seq_num 0 INFO field: GMD test #2
If all outgoing messages of a certain type need to be sent with GMD, the function TipcMtSetDeliveryMode can be used once instead of calling TipcMsgSetDeliveryMode for each message of that type.
TIBCO SmartSockets™ User’s Guide Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |