LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI Network Streaming -- Bidirectional communication between 2 applications?

Solved!
Go to solution

I'm looking at using CVI Network streaming to pass data between a master application and a slave that would connect to a device under test.  Working with the cnsWriter/cnsReader samples in CVI, I can get communication to go one direction only -- either from master to slave, or from slave to master.  However, when trying to enable both streams simultaneously, I keep getting errors saying that an application is already streaming to an endpoint in the specified context.  

 

Master code to open writing stream to slave reader:

CNSNewScalarEndpoint("ni.dex://127.0.0.2:cvi_writer/writer", "//127.0.0.2/CommandReader", CNSTypeInt32, 1000, 0, CNSDirectionWriter, CNSWaitForever, 0, &WriteEndpointID);

 

Corresponding code in slave to connect as reader:

CNSNewScalarEndpoint("CommandReader", "", CNSTypeInt32, 1000, 0, CNSDirectionReader, CNSWaitForever, 0, &ReadEndpointID);

 

Slave code to open a writing stream back to the master application:

result = CNSNewScalarEndpoint("ni.dex://127.0.0.5:cvi_writer2/writer2", "//127.0.0.5/DataReader", CNSTypeInt32, 1000, 0, CNSDirectionWriter, CNSWaitForever, 0, &WriteEndpointID);

 

And Master code to connect to data stream from slave as a reader:

result = CNSNewScalarEndpoint("DataReader", "", CNSTypeInt32, 1000, 0, CNSDirectionReader, CNSWaitForever, 0, &ReadEndpointID);

 

Is it possible for an application (or 2 simultaneous applications) to have both writer and reader streams active at the same time?

 

Thanks!

Message 1 of 2
(2,061 Views)
Solution
Accepted by topic author Sporty

Just a followup to this in case anyone else considers using the Network Streaming stuff...

 

Windows has a Named Pipes API that provides what I was actually looking for to solve my problem.  Not sure if NI just tried (and failed) to put their own wrapper around that mechanism and renamed their solution to Network Streaming, but named pipes are a much simpler solution to data exchange between 2 processes.  If you are at all familiar with the windows API for file read/writes, named pipes will be very familiar and easy to use with just a very short learning curve required to get them up and running.

Message 2 of 2
(1,988 Views)