LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read bit in TCP connection

Solved!
Go to solution

Hello,

I'm trying to read data in TCP connection.

as I understand I get a string as data from this connection.

I need to read different bits in this data

what will be the best way to do that?

 

thank you

0 Kudos
Message 1 of 6
(3,303 Views)
Are you taking about conversion? You can use convert to byte array
0 Kudos
Message 2 of 6
(3,296 Views)

kind of conversion but to binarry data.

the thing is i'm working with another program that sends binarry data and i want to be able to read each bit in it.

 

for example if the other program send "111100" i get the char of this value (means "<") and i want to be able to read the original data "111100"

 

do you know how can it be done?

0 Kudos
Message 3 of 6
(3,275 Views)
TCP/IP communication doesn't work that way. TCP/IP transfers bytes, not bits. So, do you get one byte, or do you get 6 bytes (one for each numeric value)?
0 Kudos
Message 4 of 6
(3,271 Views)
i get one byte and need to read each bit separately
0 Kudos
Message 5 of 6
(3,255 Views)
Solution
Accepted by topic author jackedi
In that case you will get a string of one character from the TCP/IP Read function. You had indicated that you want to see if, for example, the character is "<". The ASCII code for "<" is hex 3C, which corresponds to 00111100. Thus, it sounds like you just need to make a comparison against a character. If you want to check a specific bit pattern then the easiest way to do this is to simply convert the string character to a U8 and compare to a U8 constant, like this:
0 Kudos
Message 6 of 6
(3,243 Views)