TCP/IP sender and receiver and "TCP ping" application
Send TCP/IP messages to a destination IP address and port number, listen for incoming TCP/IP messages on a user-defined port, and echo received messages back to the source. Combine the sender and receiver into a single "TCP ping" application to test the communication channel between two network hosts, and illustrate the notifier method to stop parallel loops with one "stop" button.
Locate these elements with "Quick Drop" (press Ctrl+Space and start typing the name); click on an icon to see more sample code that uses that element:
Example code
Set up a network in any or all of these ways:
PC and one Academic RIO Device connected by:
USB cable to establish USBLAN network (if convenient, keep the USBLAN in place even when you try other wireless or wired options, as this opens up additional networks for experimentation)
If using the NI myRIO 1950 or NI RIO Control Module start with the NI myRIO 1900 Archive.
Different IP address: Right-click on the "NI myRIO 1900" Device, choose "Properties", and then enter the new IP address
Different device:
Right-click on the top of the project hierarchy, select "New Targets and Devices", keep the "Existing target or device" option, and then find and select your particular device
Select all of the components under the "NI myRIO 1900" device: click the first one and then shift+click the last one
Drag the selected components to the new device
Right-click the "NI myRIO 1900" device and select "Remove from project"
Open and run “RT-PC Main” under “My Computer” and each “NI myRIO 1900” target for which you have a device; note that the same VI runs without modification on the PC host as well as the Device, hence the name “RT-PC”
Enter the system name for each device, e.g., “PC”, “RIO1”, and “RIO2”; look at the label in the lower-left corner of the VI to determine the system on which the particular VI instance is running
Copy-and-paste one of the available IP addresses from one system into the “destination IP address” control of another system and then click the “ping” button; expect to see either of these results:
“Error 59, Network is down, unreachable, or has been reset” – indicates that the destination device is outside of the network for the sending host
Active “success” LED in the sending host and blinking system name in the “received message” indicator of the destination host
Expect to see IP addresses like these:
172.22.11.1 – PC node of the first USBLAN network to be established
172.22.11.2 – Device node of the above network
172.22.11.9 – PC node of the second USBLAN network to be established
172.22.11.10 – Device node of the above network
127.0.0.1 – Loopback address for each host (always available, even if not shown in the list)
192.168.x.x – Consumer-grade wireless router
Note that the “my available IP addresses” process updates once a second; try enabling/disabling the Device wireless or connecting/disconnecting the wired Ethernet to get a feel for the various networks available to each system
All three VIs must be stopped before it will be immediately evident than any particular VI has stopped, i.e., the VI cannot be edited while it is running on at least one device