Running the Application


You have now created, compiled, and linked the two programs (send.c and receive.c) that make up the initial application. One last step remains. You must start the RTserver that will route your messages.

Step 10

Start the RTserver

In one window on your workstation, start the RTserver like this:

UNIX:
$ rtserver 
OpenVMS:
$ run rtserver 
Windows:
$ rtserver 

Now run the complete application to see if the message can be successfully transferred.

On platforms that support both 32- and 64-bit, use the rtserver64 command to run the 64-bit RTserver.

Step 11

Start the sending program

You need two windows on your workstation, both set to your tutorial directory, to see the application properly. In one window, start up the sending program:

UNIX:
$ send.x 
OpenVMS:
$ run send 
Windows:
$ send 

In the window where the sending program is running, output similar to this is displayed:

Connecting to project <rtworks> on <_node> RTserver 
Using local protocol 
Message from RTserver: Connection established. 
Start subscribing to subject </_workstation1_15958> 

Step 12

Start the receiving program

To read and output the message, start up the receiving program by entering this command in the second window:

UNIX:
$ receive.x 
OpenVMS:
$ run receive 
Windows:
$ receive 

The output displayed is similar to this:

Connecting to project <rtworks> on <_node> RTserver 
Using local protocol 
Message from RTserver: Connection established. 
Start subscribing to subject </_workstation1_15978> 

Note that the receiving program never printed out the message from the sending program. In fact, the receiving program is simply hanging (blocking or waiting for a message). This is because the sending program was executed first; it sent its message, and because you had not started the receiving program, there was no process to read the message. RTserver does not send out messages if there is no process to receive them.

Step 13

Re-execute the sending program

To see the message sent, read, and output, go back to the first window and re-execute the sending program (remember, the receiving program is still running and should be waiting for the message):

UNIX:
$ send.x 
OpenVMS:
$ run send 
Windows:
$ send 

The output displayed is similar to this:

Connecting to project <rtworks> on <_node> RTserver 
Using local protocol 
Message from RTserver: Connection established. 
Start subscribing to subject </_workstation1_15983> 

This output is displayed in the window where the receive program is running:

Text from INFO message = Hello World! 

This indicates the message was read, and its fields accessed and output properly.

An important lesson here is that synchronizing processes at startup is critical. Make sure your receiving processes are started first. This is a common error for first-time developers of network programs.

In just a short time you have written your first successful TIBCO SmartSockets application.


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