01-12-2016 01:43 AM
Hello!
I have a project running with a host sending messages to a RT target (cRIO) via network streams. This is working great. Now I would like to set up a return stream from target to host but I'm stuck on one detail: Is there any way for the reader to automatically extract the network address of the remote endpoint so as to set up the return stream? I've looked through the property node expecting to find something like 'remote endpoint URL' but I can't find it. As a workaround I could always have the host send its address as a message through the first stream as part of initialization but that seems like a shame as the target clearly already knows the address of its partner. Am I missing something obvious here?
many thanks!
Solved! Go to Solution.
01-12-2016 02:46 AM
Hello bcl511,
you can use the network stream functions and when you create the reader/writer, you can set the name and the address of both the reader and the writer as constants.
In this way you don't have to pass everytime the address but you just have to write it once.
I hope my answer will help you.
Kind regards.
01-12-2016 03:24 AM
01-12-2016 05:38 AM
Hi pep91,
thanks but that is exactly what I want to avoid. I was trying to avoid hard-coding the host's IP address in the target's program. The cRIO will move between a couple of hosts in the course of testing and I don't want to have to change the host IP address manually each time.
01-12-2016 05:44 AM
sam_sharp-
Thanks for replying - I read the page you pointed me to again (I had read it before posting) and I don't see the answer to my question in there. Were you trying to imply that I have missed something fundamental? that's very possible as I'm a relatively new labview user!! Like maybe the premise of my question is completely wrong? I'll try to re-phrase my question just in case: Is there any way to make a network stream reader endpoint tell you the IP address of the corresponding writer, once the two have made a successful connection?
thanks again,
01-12-2016 05:53 AM
Hello,
Why do you need Host's IP address in the target?
You need to create the writer endpoint on the target, and create reader endpoint in the Host giving target's IP address. I've brought below what I mean in the pictures.
Target write endpoint:
Host reader endpoint:
Maybe I'm missing something...?
Thanks,
Arev
CTO | RAFA Solutions
01-12-2016 06:14 AM
hi bcl511
have a look into the network stream property node,
there are two properties that might be of use "URL" and "endpoint name"
since i cannot test it atm ..im only guessing, that you can extract the IP from "URL"
http://zone.ni.com/reference/en-XX/help/371361L-01/lvcomm/ns_propertynode/
http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/usingstreams/
:cheers: and have fun
01-12-2016 06:24 AM
arevhamb,
thank you! That does indeed solve my problem. I was thinking that the writer had to be the one to initiate the connection but your post reminded me that either end can initiate.
thanks again,
01-12-2016 06:50 AM
Hi jwscs,
thanks for the suggestion - I tried both of those and they only give information about the local endpoint, no way to get the details of the remote endpoint it seems.
01-12-2016 04:51 PM
BCL511 --
You marked a Solution, but then made some posts that seem to suggest you don't have the full answer. I have code that connects to a remote PXI running LabVIEW RT -- the PXI starts by running "Initialize Target Network Streams" (and stays there until the Host connects), and when the Host starts up, it runs "Initialize Host Network Streams", a few seconds after which the Streams (4) are established.
The Host can figure out the URL of the PXI, so when it creates its Reader and Writer Endpoints, it uses the Remote IP to form the URL input for the Create Network Stream Endpoint functions. The PXI, which doesn't "know" any IPs, just create the appropriate Endpoint Name (without the URL input being used). The Host does all the "heavy lifting" ...
Bob Schor