Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Two Network Streams?

Solved!
Go to solution

I have my network stream set up to send data from the host to the Real Time target. Works like it should. When I try to have bidirectional communication as in setting up a second set of network stream endpoints so that the Real Time target writes data back to the host machine it doesn't work/loses connection. I'm using a myRIO 1900. Is there anything special about setting up a second set of network stream endpoints that I'm missing?

Download All
0 Kudos
Message 1 of 3
(2,501 Views)

Where are you setting up the RT Writer?

 

So I have a fundamental issue with just what I have seen in your code.  Your streams really should be set up to run in parallel loops.  You should have one loop for Read and another loop for the Write.  And these should be in parallel with your main code.  You use queues and user events to pass data to/from your main loop and these communication loops.  The main reason for doing this is you can easily add code to automatically attempt to reconnect when a connection is lost.  Notice that this would eliminate the need for your global variables (which are what really scare me with your code).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(2,494 Views)
Solution
Accepted by breezy45

Resolved. Images of working changes made to network streams attached.

Download All
0 Kudos
Message 3 of 3
(2,426 Views)