In the previous example, you added fields to the message with TipcMsgAppendStr and TipcMsgAppendReal8. Then you accessed the message fields sequentially with TipcMsgNextStr and TipcMsgNextReal8. Another way to add and access fields is to associate a name with each field. The receiving RTclient can access those fields by name.
Edit the send3.c program
To modify the previous example to use named fields, replace lines 12-14 of send3.c
with this call:
Edit the receive3.c program
Modify lines 17-19 of receive3.c
to retrieve the field by name as:
TipcMsgGetNamedReal8(msg, "Answer", &var_value); TutOut("Field name: Answer, Value = %s\n", TutRealToStr(var_value));
Note: Ignore the warning message about var_name
being an unreferenced local variable.
Compile and link the programs, then start them
After compiling and linking the modified receive3.c
and send3.c
programs, start them as you did earlier. First start the new receiving program. Then, after a few moments, start the sending program.
You should see this message output from the receiving program.
TIBCO SmartSockets™ Tutorial Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |