Contents
This sample demonstrates the ability to both send and receive strings through the use of the TIBCO StreamBase® Adapters for UDP. Both the sender and receiver adapters are configured on the default port numbers; the feed simulation will work as long as the Receiver port number isn't altered.
-
In the Package Explorer, double-click to open the
udp_uni_sample.sbapp
application. Make sure the application is the currently active tab in the EventFlow Editor. -
Click the Run button. This opens the SB Test/Debug perspective and starts the application.
-
Click on the 'Feed Simulations' tab. Select 'input_stream_uni.sbfs' and click the button marked 'Run'.
You should now see tuples on the Application Output tab. There will be two copies of each tuple, one from each of the receiver output streams.
Next, try selecting the 'ReceiverControl' input stream from the drop-down menu in the Manual Input tab. Type 'disconnect' and hit 'Send Data'. This will close the connection to the multicast group for 'UDPReceiver'.
Now you should no more tuples appearing on the Application Output tab.
To reconnect, select 'ReceiverControl' and send the command 'connect'.
-
When done, press F9 or click the Stop Running Application button.
-
Open four terminal windows on UNIX, or four StreamBase Command Prompts on Windows. In each window, navigate to the directory where the sample is installed, or to your workspace copy of the sample, as described above.
-
In window 1, run
sbd udp_uni_sample.sbapp
-
In window 2, run
sbc dequeue ReceiverOutput
-
In window 3, run
sbc dequeue ReceiverOutput2
-
In window 4, run
sbc enqueue SenderInput < inputstream_uni.dat
-
The processed tuples from inputstream_uni.dat should be written on both windows 2 and 3.
-
When done, run
sbadmin shutdown
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, click
→ . -
Select this sample from the Embedded Adapters list.
-
Click OK.
StreamBase Studio creates a single project containing the sample files.
When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.
Important
Load this sample in StreamBase Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.
Using the workspace copy of the sample avoids the permission problems that can occur when trying to work with the initially installed location of the sample. The default workspace location for this sample is:
studio-workspace
/sample_adapter_embedded_udp_unicast
See Default Installation
Directories for the location of studio-workspace
on your system.
In the default TIBCO StreamBase installation, this sample's files are initially installed in:
streambase-install-dir
/sample/adapter/embedded/udp_unicast
See Default Installation
Directories for the location of streambase-install-dir
on your system. This location
may require administrator privileges for write access, depending on your platform.