LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

network streams - how to get remote endpoint URL?

Solved!
Go to solution

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!

0 Kudos
Message 1 of 10
(5,604 Views)

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.

0 Kudos
Message 2 of 10
(5,592 Views)
Probably a good idea to have a read of this: http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/endpointurls/

LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 3 of 10
(5,581 Views)

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.

 

 

0 Kudos
Message 4 of 10
(5,564 Views)

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,

0 Kudos
Message 5 of 10
(5,556 Views)
Solution
Accepted by topic author bcl511

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:

target_writer.JPG

 

Host reader endpoint:

reader_host.JPG

 

Maybe I'm missing something...?

 

Thanks,

Arev 

 

CTO | RAFA Solutions

 

Certified-LabVIEW-Embedded-Systems-Developer_rgb.jpgCertified-LabVIEW-Architect_rgb.jpg

Message 6 of 10
(5,548 Views)

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


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 7 of 10
(5,531 Views)

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,

0 Kudos
Message 8 of 10
(5,522 Views)

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.  

0 Kudos
Message 9 of 10
(5,517 Views)

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

0 Kudos
Message 10 of 10
(5,498 Views)