03-27-2018 01:24 PM
As a final project for a data acquisition I am developing a small meteorological station on one computer and getting it to communicate with another VI on a different computer, and I am lost as to how I go about doing that. I know about using shared variables to communicate across VI's, but I do not know how to use them to communicate across computers over a WiFi connection.
Any help/advice would be much appreciated.
03-27-2018 01:26 PM
I like to use the Network Streams, because the communication loss/recovery is kind of automatic. If you use simple TCP/IP VIs, you have to implement those features yourself.
Here is a description: http://www.ni.com/white-paper/12267/en/
03-27-2018 02:20 PM
I second the Network Streams. My second choice would be using the STM library, which is a library built on top of the TCP/IP API. I despise Network Published Shared Variables (nothing but problems for me).
03-27-2018 10:35 PM
As a further comment on Network Streams - although they will auto-recover, they need to be terminated and restarted if you intentionally close one end.
For example, if you have a "server" (perhaps the meteorology station) and a "client", and your client connects to the server to read some data, then disconnects, you cannot restart the VI on the client and reconnect to the same connection - the server must terminate the stream and start a new one, then wait for connection.
03-28-2018 06:12 AM
@cbutcher wrote:
As a further comment on Network Streams - although they will auto-recover, they need to be terminated and restarted if you intentionally close one end.
And to continue on with that thought...
This is also why it is a good idea to have a "watchdog". The idea there is that you send a NOOP command back and forth every so often. So if you get a timeout, that means the other side likely disconnected or got lost in its own processes. Therefore, you close the connection when you get a timeout error. Yes, you should also close the connection if you get an error saying the other side disconnected.