LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

exisiting TCP data

Solved!
Go to solution

 

I am putting together a VI to read TCP data that has a 12 byte TCP wrap (the first 12 bytes of every TCP packet of data) but I am having problems when TCP data does not exist.

 

 

readTCP.jpg

 

Is there a way to determine if TCP data exists for a specific device (IP address) before I attempt to read the

TCP wrap that is used for each TCP packet?

 

thanks

 

 

 

 

0 Kudos
Message 1 of 10
(4,036 Views)

No not really - set a suitable timeout value and ignore the timeout error (code 56) if no data comes in.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 10
(4,034 Views)

Thanks for the reply.

 

How do I ignore the time out error?

0 Kudos
Message 3 of 10
(4,028 Views)

Consult the excellent error handling chart I have attached!


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 4 of 10
(4,022 Views)

I have found what is causing the error.....

 

There sems to be a couple different variants of one field of TCP data that can either be 32 or 34 bytes of data

where if I do not read the correct number of bytes I end up with a framing error in my decoding...

 

This first byte where I am reading 1 byte in the picture below contains the number of bytes that needs to be read.

 

I would like to accomodate for reading the correct number of bytes and have tried unsuccessfully with the following:

 

bad-data.jpg

 

Any suggestions on how best to do this?

 

thanks again

0 Kudos
Message 5 of 10
(3,993 Views)

I'm pretty sure you want to stick an array index in there as the U8 out is a numeric array and you want the Zero index.

Message 6 of 10
(3,982 Views)

What is the format the byte you read for the length? Type Cast to a numeric may be what you need.

 

Lynn

Message 7 of 10
(3,974 Views)

Thanks for the replies...

 

My bad, I meant to type cast instead of the array to u8 ...

  

0 Kudos
Message 8 of 10
(3,939 Views)

bad-data.jpg

Maybe I spoke too soon...

 

The value that seems to change is the first byte of the TCP data which contains the size of the TCP data in bytes.

In what I am seeing, this first byte is 20h (0x20) when looking at the TCP data in wireshark, and when my front panel

displays this value as the indicator "String"  (with hexidecimal display style), it is shown as "18" and in probe watch [4} "|"

 

What I am trying to do is read this first byte, and then use it to read the remainder of bytes in that TCP packet but I obviously don't know what I am doing or how to do that.

 

Any help with this is greatly appreciated.

 

Thanks

 

 

0 Kudos
Message 9 of 10
(3,931 Views)
Solution
Accepted by LV-rookie

0x20 is 0d32 - which is the number of bytes in your packet. If you type cast your 1-byte length string to a U8, you should get the packet size.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 10 of 10
(3,918 Views)