LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 66 + Incomplete data received

Hello,



I am trying to establish a simple TCP/IP connection to local host itself. The Server program is sending a string(example: Hello123456). I am receiving only a part of the string(ello123456) and also receiving an error, "Error 66 occurred at TCP Read".

The peer side of the code is in java. I am sure that the peer side of the code does not close the connection, because I have kept enough time delay before it attempts to close the connection. I have also changed the options at Tools-> Options->VI Server with Port = 0 and enabled the TCP/IP connection.

 

I have attached a screen shot of error received (using Probe) and the Vi.

 

Kindly advise.

Regards,

H.


Message Edited by H P on 11-17-2009 07:55 AM
Download All
0 Kudos
Message 1 of 10
(5,136 Views)
this will help you
0 Kudos
Message 2 of 10
(5,129 Views)
Thank you Mathan, but since I am using a local host changing of IP address is not an issue.
0 Kudos
Message 3 of 10
(5,118 Views)
0 Kudos
Message 4 of 10
(5,096 Views)

Thank you Muks, but my question still remains the same :smileysad:

 

-H

0 Kudos
Message 5 of 10
(5,087 Views)
0 Kudos
Message 6 of 10
(5,084 Views)

Hello Muks,

 

I have checked out most of the online resourses, but I am not able to find out a solution. Attached to my first post is a screen shot of  the VI in the debug mode. I am receiving data sent by the 'server code' except for the first character and  error 66. 

 

Regards,

 

-H.

0 Kudos
Message 7 of 10
(5,076 Views)

What are you doing on the TCP server side?

 

The code you have is set up to read 1 byte, and use that to determine how many more bytes to read.  This is a common way of determining how much data to try to read when the length of the data string could vary.  Well, you don't have any data size prepended to the front of your string.  You are reading 1 bytes (which is the H) and typecasting that to a number (decimal 72) and trying to read those 72 bytes.  What you get is the remainder of the string (since the H has already been read).  But the string isn't long enough so you get an error.

Message 8 of 10
(5,064 Views)

Hello Ravens Fan!

 

Thank you for your mail. I see the problem now. I have improved on the design by perpending the string length before the string and sending it over. The TCP read first reads the 1st Byte (which is the string length), converts it to an Integer (by using Digital String to Number) which is then fed into the Bytes to Read of the next TCP Read. (As shown in the attached Vi)

 

My question is: Is prepending the length of the string before the actual string, the only way to read strings of variable length?

Thanks,

Regards
H

Message Edited by H P on 11-23-2009 08:56 AM
0 Kudos
Message 9 of 10
(5,021 Views)
I think if you set the mode of the VISA read as CRLF, the VISA read will terminate once those termination characters are read in the serial port.  However, if you are reading a binary data stream where those two bytes could occur next to each other as a part of real data, then the VISA read would terminate too early and your binary data stream would be incomplete.  If you can guarantee that CR and LF aren't part of the data stream, then you could use them as termination characters to mark the end of the data message.
0 Kudos
Message 10 of 10
(5,012 Views)