06-20-2016 08:52 AM
Hello everyone,
Currently, I am working on project for tcp ip communication protocol. In tcp ip write command i can know how many bytes I have written but in tcp ip command I am not able to count how many bytes i have received at data output of tcp ip read. Only i can read how many bytes i want not actual count of bytes. There is no fuction available in labview for conversion of string into byte actual byte count (not byte array) . Can you suggest me some solution for this?
06-20-2016 08:58 AM
Hi srk,
I am not able to count how many bytes i have received at data output of tcp ip read
As you receive a string from TCPIP-Read you could use StringLength to get the number of bytes read…
Can you attach a VI where you demonstrate the problem you have right now?
06-20-2016 09:20 AM
I highly recommend you have a look at the STM library and see how they handle it.
If you have the data as a string, just use the String Length, flatten that to a string, send the length and then send the data. On the read side, you first read the 8 bytes (I32) which will tell you how many bytes to read for the data.
06-20-2016 09:47 AM - edited 06-20-2016 09:48 AM
Hi GerdW,
Thank you for response. I have used string lenght. But it is giving output as same byte count as i have written for bytes to be read for tcp ip read block. It is not giving actual count of bytes.
For example, if i am sending 32 bytes from tcp ip write and i have given tcp ip read 64 bytes to be read. if i am attaching string length to tcp ip read data output, it is showing 64 bytes instead of 32 bytes!..
06-20-2016 09:57 AM
@srk007 wrote:For example, if i am sending 32 bytes from tcp ip write and i have given tcp ip read 64 bytes to be read. if i am attaching string length to tcp ip read data output, it is showing 64 bytes instead of 32 bytes!..
And I am guessing you are also getting twice the data as well.
06-20-2016 10:17 AM
Hi Crossrulz,
This is for example!... you can take value 15 instaed of 32 and any number greater than 15. It will show string length of tcp ip read (which is equal to bytes to be read for tcp ip read)..