10-13-2015 07:05 AM
Hello,
I'm having trouble setting up a simple labview programme to stream data from one computer to another. All I'm doing is creating a network stream, writing some data to it and reading it with another labview programme on another computer. I've attached the reader and the writer programmes so you can see.
The system works when I have both programmes running on the same computer and I use localhost as the IP address, but when I have them running on separate computers both connected via ethernet to the same network it doesn't work. I just run the programme and nothing happens. No connection is established, no data is sent. I'm sure I've got the right IP addresses and I can ping one computer from the other using command prompt. Can you help me figure out what's going wrong?
Thanks,
Adam
10-13-2015 07:22 AM
When I set up Network Streams between a Host and Remote machine, I only used the IP of the Remote. Thus my Host Initialize routine (which actually initialized one Writer and three Readers) used the Remote IP for all four Create Network Stream Endpoint calls, whereas the corresponding Remote Initialze routine didn't use IPs at all. I don't know why you couldn't have a "mixed IP" situation such as you describe, but it seems simpler to only have to deal with a single IP address.
See if this helps for you.
Bob Schor
10-13-2015 07:38 AM
Are you saying I should use the reader IP address to create both streams, the one which sends data and the one which sends an acknowledgment in reply? I've just tried that and it doesn't seem to make any difference.
(Just to be clear: when I referred to using 'localhost' as the IP address, that was in a previous version of the programme, which I was just using to test that the code worked. Now I just have two computers, one which sends data and other which sends a reply when it gets the data. I only need one IP address to initialise each of these streams.)
10-13-2015 09:33 AM
When you have multiple Streams, it is tricky to talk about "Reader" and "Writer", which is why I used "Host" and "Remote" (to refer to the two machines, each of which has an IP). The Host "knows" the IP of the Remote, but the Remote does not know the IP of the Host. Note that for this to work, the Remote should start first, and should be set up to wait bascially forever for a connection. On the Host, I create Writer Endpoint, then create Reader EndPoint, giving each of the Host Endpoint routines a 15-second timeout, and if both fail three times, stopping the Host and saying "Please make sure the Remote is running". Note that these Host Endpoint routines specify the IP of the Remote..
On the Remote side, the Create Write and Create Reader Endpoints are configured to run in parallel, since I don't (in principle) know which request will come first. These functions also have a 15-second timeout -- if they all succeed, I exit this routine (this is a separate "Initialize Remote Streams"), otherwise I clear everything and start the loop all over.
Bob Schor