LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tcp/ip using CRLF

Solved!
Go to solution

Hello,

 

I am using LV2009 for linux.

 

I am trying to communicate between my Java code and LV, on localhost, using TCP/IP. I am sending the data: "Hello1\r\n", "Hello1\r\n", "Hello1\r\n" from java to LV. At LV end, I am using the CRLF mode to read the data sent. I am not receiving any data at LV end. I do not want to use the standard mode, because the length of data sent could vary each time. I also tried using Immediate mode, but again I am not seeing any thing on LV.

 

Please help.

 

Regards,

 

-H

Message 1 of 8
(7,393 Views)

One approach you can take which I use regularly is to have your reads in two parts. Your first read would wait longer which would also act as your data timeout. It would look for a single character. The second read would be within a loop and read until it sees your CR and LF characters or other termination characters. This read would have a short timeout since at this point you should get all of your data.

 

Another alternative is to have a parallel task which does nothing but read from the connection. Anything it reads it would post to a queue. A second task would then process this data. It may need to dequeue several items to get the entire message but it would be responsible for parsing the data. The queue would essentially act as a buffer. You would also need a shift register on this loop to hold the partial messages.

 

A third alternative would be to use VISA for the connection and use its read attribrutes which include the option to read until you get a termination character.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 8
(7,382 Views)

Hello Mark,

 

My problem here is that I am not receiving any thing at the data output. I have also tried changing the timeout value to -1, but it doesnot help either.

 

-H

0 Kudos
Message 3 of 8
(7,379 Views)
Solution
Accepted by topic author H P

I think I was missing the number of bytes as an input to the 'bytes to read'. Attached is the corrected vi.

 

Regards,

 

-H

0 Kudos
Message 4 of 8
(7,373 Views)

I am having the same problem.

Could you post your vi for version 8.6?

 

Thanks!

 

Nick 

0 Kudos
Message 5 of 8
(7,286 Views)
I hope it helps.
0 Kudos
Message 6 of 8
(7,282 Views)

It still says that the vi version (9.0) is newer than my version (8.6)...

Could you retry it?

 

Thanks 

0 Kudos
Message 7 of 8
(7,266 Views)
Here is it in LV86.
0 Kudos
Message 8 of 8
(7,263 Views)