05-28-2017 09:41 AM
Hello there,
i want to start a network stream and i tried to understand this with the "simple network streams - Host/Target"
i've reduced the example in the way, that only the host ist sending data to the target.
For the real measurement system i want, that the host try to send all the time, also if the reader is not reachable.
In the example, if i try to run the host and not the target and change the values the create network stream writer don't pass any value, not even an error, so the whole program gets stucked.
Is there any possibility to skip this step (something like: after 1 second, if no reader was found restart)?
Kind regards,
Filos92
Solved! Go to Solution.
05-28-2017 01:16 PM - edited 05-28-2017 01:18 PM
If you set the Create Endpoint function with a TimeOut (other than the default -1, which waits for 7 weeks, at least), when the TimeOut expires without a connection, the function will return an Error. You can use that Error to do whatever you want, such as loop back and wait again, or "proceed without a Network Stream Connection" (be sure to clear the Error -- the Clear Error function does a clean job of this).
Bob Schor
P.S. -- attaching a Project file for your project is almost useless, as it points to files on your hard drive. Better would have been to say "I'm using the Simple Network Stream Example that ships with LabVIEW". Sending a picture of a Block Diagram is also not as helpful as actual code, i.e. a .VI file.
05-29-2017 08:40 AM
At first thanks for your quick awnser!
I'm sorry for the circumstances, hopefully this time the VIs works.
I'am a little confused because as long as no timeout is connected (and as long the reader is running) it works.
If i connect the default value of -1 it get stucked.
for every other value (1, 100, 1000) i get the timeout error.
05-29-2017 09:08 AM
@Filos92 wrote:
I'am a little confused because as long as no timeout is connected (and as long the reader is running) it works.
Yes. If the Reader is running when you try to connect with the Writer, the connection should immediately succeed, regardless of the TimeOut value.
If i connect the default value of -1 it get stucked.
If the Reader is not running, the default "Wait Forever" (or 7 weeks, whichever comes first) setting will wait a very long time before it times out!
for every other value (1, 100, 1000) i get the timeout error.
That's exactly the point! When/if this occurs, your program can "tell" that the Reader is not running, and you can make a programmatic decision about what to do. Suggestions are:
- Repeat the whole thing 3 times, just in case the Reader is slow getting going, and then fail (this is what I did for my LabVIEW RT system).
- Fail, giving a message "Hey, Dummy, the Reader needs to be turned on!".
- Combine the above two approaches -- tell the Operator that the Reader is not running and offer some options, including "Start the Reader and Try Again", "Stop/Exit, Start the Reader, then Rerun the Program", or "Go have Dinner and Try Again Tomorrow".
The point here is that if you see an Error on the Error Line, you can "trap" it in a Case Statement (wire the Error Line to the Case Selector), and in the Error Case, you can place a Clear Error function and whatever code you want to use in the "Reader Is Not Running" case.
Bob Schor
05-29-2017 10:15 AM
for every other value (1, 100, 1000) i get the timeout error.
Sorry, i was a little inaccurate here.
If the reader is running and no timeout is set it works. But if i set the timeout (even if i try -1 to wait forever) I get the timeout error even when the reader is running.
05-29-2017 12:55 PM
That seems strange to me. Let me describe the system I have for Network Streams, and how it works for me (it may turn out to depend whether the Host or Remote is the one with the IP Address ...).
So ordinarily, the Remote is running and waiting, and we have no problems. However, when the Host ends, we tell the Remote to reboot, which can take a few seconds to accomplish. In some instances, we tell the Host to "Start over again" -- the Host code stays in memory, the Remote is told to reboot, and then the Host once again calls its Initialize Network Streams routine, but now the Remote is not (yet) running (as it is busy rebooting). What we observe is that the Host "hangs" for 20-30 seconds, then starts running, having made the connection with the Remote.
Sorry for the long-winded explanation. It is curious to me why you are not seeing a comparable behavior. However, if you have Network Streams running in both directions and you are trying to establish them "bi-directionally" (where each side has initialization code specifying the URL of the other side) instead of "uni-directionally" (where all the URL specifications are on either the Host or Remote, as I've done), there may be some "interesting" behavior, depending on "Who goes First".
Bob Schor
05-30-2017 02:52 AM
I'm very thankfull for your effort.
I will test your tips as soon as possible, but i'm not in my institute for the next time.
So I can only responde in a few days, sorry.
But up to then,
many many thanks for your help!
06-08-2017 07:27 AM
I didn't solved the problem for Network streams. If i set a timeout nothing happens anymore.
But I solved it by using a TCP connection. Again thanks for your help!