03-12-2021
06:06 AM
- last edited on
04-28-2025
04:55 PM
by
Content Cleaner
Hi, everyone. I'm learning how to use network streams in CVI, but is having some trouble understanding the "context" part when specifying an endpoint.
I have made a minimal example of two applications on the same PC trying to communicate with each other, which is attached to the question. I started by following the networkstreams examples given with CVI (especially cnsSimple). What I want to do is to specify endpoints so that the two programs can have a bidirectional communication. At best I have managed a one-way communication. As the attached example will show, I'm currently getting the error:
"-6968 CNSErrLogosXTDuplicateService: Another application is already streaming data to an endpoint in the context you specified. If you specified a context name in the reader name or writer name terminal of the endpoint, you must specify an unused context name. If you did not specify a context name, you must specify an unused context name by entering an endpoint URL in the reader name or writer name terminal."
The help manual specifies that I need to specify the endpoint in the following format: ni.dex://host_name:context_name/endpoint_name. In my application I have tried giving one the context "cvi_reader" and the other "cvi_writer". I have tried reading up on the meaning of context_name by checking the following sources:
These are both LabVIEW but things usually work the same way in CVI. I have tried following all instructions, but it's apparent that I'm not quite understanding what's going on.
Things are further complicated because I don't understand at what endpoint I should use what URL formatting. Depending on if my endpoints are supposed to be active or passive I should use different ways of specifying the endpoint URL. (Connecting Network Stream Endpoints Together - LabWindows/CVI 2017 Help - National Instruments (ni.c...). I don't even know for sure what I'm supposed to be using in my case, but I'm guessing I want one active and one passive in each application (active writer and passive reader).
I guess I would like answers to the following:
Many thanks to anyone who can dummy it down for me.
Solved! Go to Solution.
04-06-2021 03:25 AM
Hi!
I would really appreciate it if anyone could give me a clarification on this subject!
Thanks!
04-06-2021 05:42 AM
I was hoping to use Network Streams for interprocess communication between 2 CVI applications that my employer uses as part of a test automation package. However, I was unable to get much past the problems that you also seem to be encountering, and there wasn't much advice available here on the forums to help out. Ultimately, I ended up just using the Windoze API for Named Pipes to get the job done. Seems like NI's Network Streams are just them putting a wrapper around IPC functions anyway. Unfortunately, they didn't do a very good job implementing, testing, or documenting their version, so using Named Pipes ended up being a much easier and more reliable solution for us.
04-09-2021 03:57 AM
Hi!
I managed to figure it out after taking my mind off the problem for a little while!
I attached an archive with two examples, a minimal one just establishing a bidirectional contact, and a more extensive one actually transmitting data in both directions. In the example they simply take turns writing data to each other, but I can't see any reason why it wouldn't work simultaneously if you were using threads or some other way of parallelizing the process.
The issue, as suspected, was how to name the contexts. When you google around you see different approches and it's easy to get lost in what's supposed to work and not. The error messages also ususally doesn't help to pinpoint the problem unless you already understand how stuff works. I can't say I fully understand how the context names work, but at least I have something that runs - and that's good enough for me for now.