<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: interpreting TCP read output string in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3319552#M972755</link>
    <description>&lt;P&gt;Hi LV-Pros,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm fighting with something similar. I use the following library to connect to my MySQL server: &lt;A href="https://decibel.ni.com/content/docs/DOC-10453" target="_blank"&gt;https://decibel.ni.com/content/docs/DOC-10453&lt;/A&gt;&lt;/P&gt;&lt;P&gt;A awesome tool, because my applicaiton needs to run on Mac and Windows (LV nativ tools, no connectivty tool kit required)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, it only works for 128 characters, because LV only get the 128 characters right (no matter if it's the 'TCP read' or the 'string to byte array' function. the byte interpretation higher 127 is also OS dependant (Win has something different than Mac). Is the TCP read output string dependant on ASCII? I believe (sorry, my knowleadge is biotech, I know not too much about programming), that the MySQL DB sends UTF-8 and since ASCII and UTF-8 are the same up to 128, TCP read brings the correct string back. Higher then 128 the Server sends a unsigned word, so u16, as far as i understand the whole thing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now how can I tell the TCP read function to interpret the data send as utf-8, coded in u8 und u16? I'm totally lost ... &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all and sunny greetings from Switzerland&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jul 2016 10:52:46 GMT</pubDate>
    <dc:creator>Sapiophile</dc:creator>
    <dc:date>2016-07-08T10:52:46Z</dc:date>
    <item>
      <title>interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309739#M968914</link>
      <description>&lt;P&gt;What is the proper method to interpret data from the TCP Read function? The output is a string of characters, which are obviously not hex values. How do I convert the string into a binary array or bytes?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:23:37 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309739#M968914</guid>
      <dc:creator>jmountney</dc:creator>
      <dc:date>2016-06-15T18:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309745#M968917</link>
      <description>&lt;P&gt;I don't know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if you attach what the data looks like in the string of characters, and tell us what you what the data is supposed to say, then we might be able to interpret.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use "String to Byte Array" to convert the string to an array of bytes.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:27:41 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309745#M968917</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2016-06-15T18:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309755#M968923</link>
      <description>&lt;P&gt;How to interpret the data completely depends on what you are communicating with.&amp;nbsp; If you are dealing with binary data, I find the Unflatten From String to be very useful.&amp;nbsp; But to get any more specific, we need to know the instrument and/or the messaging protocol it is using.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:34:08 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309755#M968923</guid>
      <dc:creator>crossrulz</dc:creator>
      <dc:date>2016-06-15T18:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309765#M968929</link>
      <description>&lt;P&gt;I read 1032 bytes. The first 4 bytes should be equal to 5, 6, 7, or 8. The next four bytes should always equal 1024. The remaing 1024 bytes are arbitrary measurement data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached a screenshot of the block diagram and resulting output from the TCP Read function, the conversion using the String to Byte Array function as well as the Type Cast function. None of the outputs seem to make sense, escpecially the ouptut of the TCP Read block.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:52:45 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309765#M968929</guid>
      <dc:creator>jmountney</dc:creator>
      <dc:date>2016-06-15T18:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309771#M968932</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/278953"&gt;@jmountney&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;The next four bytes should always equal 1024.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I don't quite understand that statement.&amp;nbsp; A byte can only have the value of 0-255.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or are they 4 bytes that if they are typecast together into a U32 would be equal to 1024?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;jmountney wrote&lt;BR /&gt;&lt;P&gt;I read 1032 bytes. The first 4 bytes should be equal to 5, 6, 7, or 8.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What do those 4 bytes mean?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think you may need to go back and look at whatever program is putting the data into the database.&amp;nbsp; Is it another LabVIEW program?&amp;nbsp; Perhaps what it is putting in isn't quite what you think it is.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:57:41 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309771#M968932</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2016-06-15T18:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309773#M968933</link>
      <description>&lt;P&gt;The first 4 bytes (32bits) define a message type. There are 4 types of messages (5, 6, 7 &amp;amp; 8).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second&amp;nbsp;4 bytes (32 bits) would equal 1024. This values simply defines the length of the data in the remaining part of the message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:07:24 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309773#M968933</guid>
      <dc:creator>jmountney</dc:creator>
      <dc:date>2016-06-15T19:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309799#M968944</link>
      <description>&lt;P&gt;Ok,wild guess time.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first four bytes are a clue to SYNC&lt;/P&gt;&lt;P&gt;The next four bytes 0 4 0 0 are a 32 bit integer, least sig byte first. 1024&lt;/P&gt;&lt;P&gt;Then you have 6 0 0 0, which could be another 32 bit integer, lsb first. 6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then your random data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rod.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:52:55 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309799#M968944</guid>
      <dc:creator>Rod42</dc:creator>
      <dc:date>2016-06-15T19:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309800#M968945</link>
      <description>&lt;P&gt;Forget what I said about a database.&amp;nbsp; I was confusing another thread with this one where the person was having very similar problems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obviously, what you are getting doesn't match what is being sent.&amp;nbsp; You aren't getting 5 6 7 8.&amp;nbsp; The first 4 characters spell out SYNC like you see.&amp;nbsp; The next 4, 0 4 0 0 if it is MSB byte last, does equal 1024.&amp;nbsp; The next 4 bytes are 6 0 0 0.&amp;nbsp; Does the number 6 mean anything to you?&amp;nbsp; Is taht the message type of either 5 6 7 or 8, but it is saved as a 32 bit number?&amp;nbsp; After that, things start looking like a pattern of data stored in binary.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:56:14 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309800#M968945</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2016-06-15T19:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309827#M968956</link>
      <description>&lt;P&gt;Ahhhh................ Thank you. Now it makes sense. I now feel like an idiot.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:46:31 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3309827#M968956</guid>
      <dc:creator>jmountney</dc:creator>
      <dc:date>2016-06-15T20:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3319552#M972755</link>
      <description>&lt;P&gt;Hi LV-Pros,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm fighting with something similar. I use the following library to connect to my MySQL server: &lt;A href="https://decibel.ni.com/content/docs/DOC-10453" target="_blank"&gt;https://decibel.ni.com/content/docs/DOC-10453&lt;/A&gt;&lt;/P&gt;&lt;P&gt;A awesome tool, because my applicaiton needs to run on Mac and Windows (LV nativ tools, no connectivty tool kit required)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, it only works for 128 characters, because LV only get the 128 characters right (no matter if it's the 'TCP read' or the 'string to byte array' function. the byte interpretation higher 127 is also OS dependant (Win has something different than Mac). Is the TCP read output string dependant on ASCII? I believe (sorry, my knowleadge is biotech, I know not too much about programming), that the MySQL DB sends UTF-8 and since ASCII and UTF-8 are the same up to 128, TCP read brings the correct string back. Higher then 128 the Server sends a unsigned word, so u16, as far as i understand the whole thing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now how can I tell the TCP read function to interpret the data send as utf-8, coded in u8 und u16? I'm totally lost ... &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all and sunny greetings from Switzerland&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 10:52:46 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3319552#M972755</guid>
      <dc:creator>Sapiophile</dc:creator>
      <dc:date>2016-07-08T10:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3319671#M972809</link>
      <description>&lt;P&gt;TCP read brings back strings, but in reality, a string is just a series of bytes.&amp;nbsp; What you do with that series of bytes is up to you.&amp;nbsp; If you just display the string, LabVIEW will show the bytes according to its ASCII table.&amp;nbsp; You can typecast the string to a U8 array.&amp;nbsp; You can typecase it to an array of&amp;nbsp; U16, I16, U32, ......&amp;nbsp;&amp;nbsp; or to other more complicated structures if you know how the data is laid out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What does the data represent in the database, and how do you want to view it in your LabVIEW program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 13:59:11 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3319671#M972809</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2016-07-08T13:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3321244#M973457</link>
      <description>&lt;P&gt;Thank you for the description.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In terms of interpretation, I struggle with strings (MySQL - TEXT). If there are special characters, LV interprets them as ASCII instead of utf-8. Is there a way to interpret the outcome of the TCP read as utf-8? Think there is a function Flatten/Unflatten String, but I do not know how to use it in my case. My temp solution is kinda hack, not a real solution, vi attached ...&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 06:30:16 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3321244#M973457</guid>
      <dc:creator>Sapiophile</dc:creator>
      <dc:date>2016-07-13T06:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: interpreting TCP read output string</title>
      <link>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3321267#M973459</link>
      <description>&lt;P&gt;now incl. the vi ...&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 07:37:45 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/interpreting-TCP-read-output-string/m-p/3321267#M973459</guid>
      <dc:creator>Sapiophile</dc:creator>
      <dc:date>2016-07-13T07:37:45Z</dc:date>
    </item>
  </channel>
</rss>

