LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Send an initialization packet (header) once then body continuously using TCP

Hello, It is now working almost perfectly.

The only thing is that, I must make it work with tcp open inside the loop and in such a way it executes only once (otherwise many connections will be created). This way, the entire VI will be used as an icon with other VIs in a loop.

Kindly assist me!

0 Kudos
Message 11 of 18
(604 Views)

@idir93 wrote:

But I don't want to use any loop. I want this to become a VI where the user will use it inside his while loop.


In that case, make an API.  Make one VI that performs the connection and sends the header data then another that just sends your data.  Now the user can call the first VI before his loop and the second inside the loop and close the connection whenever they are done.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 12 of 18
(598 Views)

Thanks a lot.

So you mean I will have two VIs?

Please elaborate more, or make an example VI of possible.

Regards,

0 Kudos
Message 13 of 18
(592 Views)

@idir93 wrote:

So you mean I will have two VIs?


That is exactly what I mean.  Again, one VI to connect and send the header and another to send your data.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 14 of 18
(585 Views)

I did it with feedback nodes. It works fine. but is it reliable? kindly tell me what's missing for a reliable communication.

Regards,

0 Kudos
Message 15 of 18
(579 Views)

Feedback nodes are a different variation of shift registers that don't require a loop.  They may be just fine.

 

A major problem in your code is the use of the LabVIEW exit function and Stop function.  Particularly the Stop, since the code will stop before it ever gets a chance to execute the case structure that closes the TCP/IP connection.

 

It feels like you are trying to force code in a way that is just not natural.  I suggest taking LabVIEW tutorials and browsing the forums more to find examples of code that are better.
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 16 of 18
(572 Views)

Thank you for your feedback.

Please tell me how i can resolve the stop button issue.

Also, what is unnatural in my code? I did watch video tutorials though.

0 Kudos
Message 17 of 18
(569 Views)

What did you put in those LabVIEW exit and LabVIEW Stop functions?  The fact that both are in there are very strange.

 

I guarantee you don't want either of those in there.

 

The feedback node on the error wire doesn't seem right.  And I'm not sure the feedback wire is quite right on the TCP/IP reference, but I can't tell because you posted an image rather than an actual VI and I can't see what is in the other cases.  Beyond that, it is something just doesn't feel right to me about your code.

 

I think you would be better off if you take the advice that crossrulz gave you about breaking it into two separate subI's rather than forcing it into one.

0 Kudos
Message 18 of 18
(554 Views)