LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error 56 tcp read

Hi,

 

I'm having trouble with the TCP connection. My computer I am working on will be the server, or the listener, which is trying to connect with a linux based computer. I am able to successfully create a connection using TCP listen. When I am trying the TCP read, I am getting an error 56. I understand it is with the timing. I also tried to run the program with an unlimited amount of time (-1), but this did not seem to resolve the issue. I've attached the screen shots of the code. Server_Listen is the connection to initiate the listening, and Server_Read illustrates how my read is implemented.

 

Help? 🙂

 

Thanks,

Andrea

Download All
0 Kudos
Message 1 of 8
(9,945 Views)

More likely than not you are not receiving 20 bytes of data. Your read is expecting to receive 20 bytes. If you don't you will get a timeout error and the whatever data that you did read will be returned. If you set the timeout to -1 you will read forever until 20 bytes are received. It is quite common in network applications to get a timeout when you don't know how much data you will be receiving. You use this timeout to determine if you did receive a block of data. Further processing can determine if you received the complete data or not. In cases where you have a protocol you need to read data according to the defined protocol. A very common and simple protocol would send a 4 byte value indicating the amount of data to follow. In a case like this read 4 bytes, convert it to an integer and use this as the amount of data for the next read.



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
0 Kudos
Message 2 of 8
(9,934 Views)

The method Mark suggested can be seen in the "Simple Data Client" and "Simple Data Server" examples that ship with LabVIEW. Just open the Example Finder (Help -> Find Examples) and search for "tcp/ip".

0 Kudos
Message 3 of 8
(9,920 Views)

I can't seem to read 4 bytes ... What does this generally mean? I know I can initiate a listen. Not sure the meaning of this.

 

Thanks,

Andrea

0 Kudos
Message 4 of 8
(9,915 Views)

This could mean that the device sending the data to you is sending less than 4 bytes. You need to look at the specifics of the device you are talking to regarding what data and how itis formated will be communicated. The example I gave above was simply that, an example. It more than likely does not match your specific device.

 

Try reading 1 byte at a time until you get a timeout. This will at least help you to see what data is there. When you did get a timeout did you look at the returned data? Was there anything there or are you reading nothing.



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
0 Kudos
Message 5 of 8
(9,910 Views)

Hi everyone,

 

I'm also having a problem with my TCP Read: using the Highlight execution I can see that Labview is communicating - no 'error out' - , but my 'bytes written' are always zero, no matter what type of data I send!

 

What could be the source of this problem?

 

Thank you,

M. Assad

0 Kudos
Message 6 of 8
(9,639 Views)

When I worked this awhile ago, I found I had an issue with my receiving end. Not sure if it helps - maybe someone can enlighten the specifics of your issue.

0 Kudos
Message 7 of 8
(9,623 Views)

Andrea,

 

Thank you for your reply! I've found out that my code works only with double variables - not sure why...

 

Now I'm trying to receive multiple signals (from two different sensors), any thoughts on that?

 

 

 

 

0 Kudos
Message 8 of 8
(9,614 Views)