LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Network Streams Example Is Buggy

Okay so the title might not be the best but I couldn't think of a better way to word it.  Buggy might not be the right work, but it certainly needs some improvement.  I was using network steams for a project and it was having some issues trying to close and reopen a connection so I opened the shipped example "Simple Network Streams" to see how NI recommends using them.

 

This example has a host and target VI.  If you run one of them, then click stop, the VI keeps running and does not stop, this is my first complaint.  The reason for this is that the connection timeout is set to -1 meaning it will wait forever for a connection and not allow other UI interactions to take place until a connection is found.  This is a terrible design for a Host with a UI the user sees, and a better one would be a finite timeout, which would then retry connecting over and over.  This was the type of application I wanted to eventually end up with.

 

Another issue I found with the example is it only works once.  If you run the Host, then run the Target the example works.  Changing the frequency on the host sends that message to the target and then the waveform is sent back to the host.  Now click stop on either VI and they both stop.  Now run the host and run the target again.  The example no longer works, and to get it to work again you have to stop and close both VIs, then re-open and run them again.  I don't remember the source of the problem but I suspect it has something to do with closing references at the end of the first run.

 

New developers looking to use network streams are going to start with this example and find that their applications have the UI locked waiting for a connection, with no safe way to abort.  No retry strategy if a connection is lost, and no way to recover from a network that gets disconnected, and tries again.

 

The attached VI's aren't perfect but they take the shipped example and improve some of these issues by allowing the UI to respond, and a few fixes.  If you run my Host, and my Target it will work as expected.  You can then stop the client, and re-run it and the connection comes back.  You can also run the Host, and stop it, without needing to start the Target.

 

Is there other examples of Network Streams I missed?  Are there better examples to be used?  Does this not really matter and the example is just used to demonstrate the technology?

Message 1 of 14
(3,753 Views)

Hi Hooovahh,

 

Great observation. I had been using this example as a basis for a while without noticing those details.

As this is a simple example to get started, I wouldn’t say that it‘s completely necessary to handle connections and disconnections. If you follow the instructions by running both VIs that problem shouldn’t show up. I understand that a more professional architecture would require handling this special case.

 

The problem with the VI just running well once should be corrected. I have generated an internal report to make aware of this situation to the right people. This is happening because the loop that sends data to the host from the target is stopping at the first iteration because the global Target Stop is not being properly initialized to false at the beginning of the code.

Thank you for your feedback!

 

Regards,

AGJ

NI

0 Kudos
Message 2 of 14
(3,708 Views)

Hi Hoovah,

I have been working with the simple network stream example from "Find Examples" and haven't had much luck solving the issue until I ran accross your post. I have been experiencing the same issues as what you originally found, but I still see the bug in your two files.

If I stop the target VI while the host is running and re-run it, it works. But if I stop the host while the target is running and re-run it, they both freeze.

I cannot find a good architecture that works. Stopping either VI while the either is running is a possibility in my application. I have been told by NI that network stream is my solution, but it does not work reliably.

 

Any thoughts or feedbacks from NI?

 

Thank you,

TeamHalli

0 Kudos
Message 3 of 14
(3,536 Views)

I must confess that I never looked at the NI examples.  I tried out Network Streams several years ago, found a bug that would give the "We apologize for the inconvenience" message when I edited a VI with some Network Stream Elements present (I learned at NI Week that they'd found and fixed the bug), after which I explored and found a method of creation and usage that "worked for me".

 

I'll try to play with the NI example, maybe substituting some of my code, and will let you know what I find.  It may take a few days ...

 

Bob Schor

0 Kudos
Message 4 of 14
(3,503 Views)

Hmm.  I just looked at (and tested) the Simple Network Streams example shipping with LabVIEW 2015.  It seems to work fine for me "as is".  Even the bug that AGJ noted looks like it has been fixed.  I notice that the code Hooovahh attached seems to be from LabVIEW 2013 -- it certainly looks different from the version I tested.  Could this be a "repaired Bad Example"?

 

BS

0 Kudos
Message 5 of 14
(3,489 Views)

Hi guys,

 

Indeed Bob is correct. The bug was solved for LabVIEW 2015. The same example for previous versions of LabVIEW would behave incorrectly as described on the original post.

 

Regards,

 

AGJ

NI

0 Kudos
Message 6 of 14
(3,480 Views)

Ok thanks,

Could someone please post the 2015 Example to be opened with LabVIEW 2013 please?

 

Thanks,

 

0 Kudos
Message 7 of 14
(3,473 Views)

By the way, are the LabVIEW examples available somewhere on the web in case I overwrite the one on C:/

0 Kudos
Message 8 of 14
(3,469 Views)

Sorry I hate to do this to your post in this forum but it seams I have no choice, I've posted in these forums before but it seems now I can not create a new question

If I click on Message it takes me to my profile messages and down at the bottom there is nothing to allow me to post a new question. I can post to a question that is already asked??? 

 

Again sorry for asking this here but it seems I can't ask anywhere else except a question that has been asked by someone else

Capture.JPG

0 Kudos
Message 9 of 14
(3,454 Views)

I've "Saved for Previous Version, 2013" the LabVIEW 2015 example.  Note that the example includes a Project that, as near as I can tell, simply includes all of these files.  Two Warnings (see enclosed pictures) popped up, noting that the LabVIEW 2013 version of some NS functions were missing inputs in the 2015 versions.

 

Bob Schor

Message 10 of 14
(3,439 Views)