How to read binary floating point values from TCP/IP

I am attempting to use a LabView application to read an array of binary single precision floating point numbers transferred through a TCP/IP connection from a Windows C++ program. The endianization occurs before the values are sent to the Labview application. When I read the values in LabView, some values are interpreted correctly, some are not. For instance, the C program is sending a 6 as one element, and 7 as another. Labview interprets both as 6. The difference between 6 and 7 in binary format is 1 bit (bit #21 if counting from 0 in LabView format). There are 2 other values that show the same error- 459.67 is being sent, 395.67 is read by labview (1 bit difference, exact same bit... 7.5 is being sent, 6.5 is being read by LabView (1 bit difference, exact same bit). LabView reads that bit as 0, when it should be 1.
This seems very odd to me because most values are being read correctly, including other values with that same bit on. There are values being read correctly that are both before and after the incorrect values in the array, so it's not just an issue with an offset or something in the bit stream. Additionally, when attempting to read an array of values with all bits on, I get a strange pattern of 111110011111100111111001111110.
We have also verified that the binary representation for the values is the same on both machines, once you account for the byte swapping. What am I missing here? How in the world can some values come across correctly and others incorrectly? Any help would be greatly appreciated! Our fallback is to transfer everything in ASCII, which is going to greatly increase packet sizes.
Thanks,
Jason

Update:
Problem fixed. I say fixed and not solved because I don't know why it's fixed. I had been storing the TCP/IP read in a string and passing it through a shift register after each read. I would then concatenate it with the TCP/IP read result in the next loop. After each read, it would search the concatenated string for ASCII flags. When it found them, it would strip off the flags and then type cast the rest as single precision floating points.
I knew I would be getting the same number of bytes each time, so I ditched the ASCII flags and had just the binary values sent. This way, I expect to get all of the values in one TCP/IP read. No values are passed through a shift register to the next loop and there is no concatenation of the string outputs from TCP/IP read.
I'm not sure if it was the ASCII flags being included or something with the way I was manipulating the string that was causing the binary values to be interpreted incorrectly. Hope this helps someone else.
Jason

Similar Messages

  • How can I get a floating point value from Labview 6 into VB 6

    I need a numeric value from Labview and use it in my Visual Basic program. How can I do that...
    Thanks

    Hello jardinpaul,
    You can use Visual Basic to call a LabVIEW DLL that you create from your LabVIEW VI. Take a look at this example on our website:
    Using Microsoft Visual Basic to Call LabVIEW DLLs That Pass Numeric Data Types
    David McClelland
    NI Applications Engineering

  • Read binary and ascii values from input stream

    Hi All
    I want to read a stream that consist both binary values and ascii values. Length of the stream cannot anticipate. Can you help me?
    Thanks

    Sameera wrote:
    Hi All
    I want to read a stream that consist both binary values and ascii values. Length of the stream cannot anticipate. Can you help me?
    ThanksHave a look at this:
    Character and Byte Streams
    http://java.sun.com/docs/books/tutorial/i18n/text/stream.html

  • Passing floating point values, but being recognised as doubles and int's?

    Hi,
    I was wondering how to differentiate between floating point values and ints etc
    I am passing values into a public class with the parameters (float... values)
    Public Example (float... values){}new Example (1, 1e2, 3.0, 4.754);
    It accepts it if I just use 1,2,3,4 as the values being passed in, but doesn't like it if I use actual float values.
    How come?
    Cheers

    chokpa wrote:
    Public Example (float... values){}
    new Example (1, 1e2, 3.0, 4.754);It accepts it if I just use 1,2,3,4 as the values being passed in, but doesn't like it if I use actual float values.Those are double literals, try
    new Example (1f, 1e2f, 3.0f, 4.754f);

  • How to read and update the value of property file

    Hi,
    I am not able read the values from property file.
    Please tell me how to read and update the values from property file using Properties class
    This is my property file : - Config.properties its located in D:\newfolder
    Values
    SMTP = localhost
    Now i need to change the value of the SMTP
    New value :
    SMTP =10.60.1.9
    Pls Help me
    Thanks
    Merlin Rosina,

    Post a small (<1 page) example program that forum members can copy and run that demonstrates your problem.

  • How to gather a set of floating point numbers from a web page form?

    I am pretty new to Java and I am working on a project to apply Benfords law to find the probability of digits submitted by the user. My first step is to gather set of floating point numbers from a web page. How do I go about doing this? Any suggestion or a proper site where I can learn this stuff will be highly appreciated.

    I am using NetBeans IDE 5.5.1 and for this project. I have realized that the first question was not well phrased.
    I created a web project with 2 jsp files and a class file in it. When my jsp file runs I ask the user to enter a number for finding the probablility based on Benfords law.
    This is what I got so far:
    This is input.jsp
    <h1></h1>
    Please enter a number to be checked
    <form action="result.jsp" method="post">
    <input type="number" name="number" >
    <input type="submit" value="Check number">
    </form>
    </body>
    </html>
    This is result.jsp
    String number=request.getParameter("number");

  • How to get unloading point value from Production order?

    Hi
    Can u tell me how can i get the Unloading Point  value from Production order where the
    Warehouse no,
    Movement Type AND
    Requirement Type F is given
    Kindly send me full select query (Table name-field name).
    Moderator message: please search for available information and try solving things yourself before asking.
    locked by: Thomas Zloch on Sep 24, 2010 9:15 AM

    Try these options.
    Table: AFPO
    Field: ABLAD.
    Table: AUFM
    Field: ABLAD.

  • How can we read the screen field values from the report selection screen wi

    Hi expart,
    How can we read the screen field values from the report selection screen with out having an ENTER button pressed  .
    Regards
    Razz

    use this code...
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.
    **Read the Values of the SCREEN FIELDs
    CALL FUNCTION 'DYNP_VALUES_READ'

  • Precision loss - conversions between exact values and floating point values

    Hi!
    I read this in your SQL Reference manual, but I don't quite get it.
    Conversions between exact numeric values (TT_TINYINT, TT_SMALLINT, TT_INTEGER, TT_BIGINT, NUMBER) and floating-point values (BINARY_FLOAT, BINARY_DOUBLE) can be inexact because the exact numeric values use decimal precision whereas the floating-point numbers use binary precision.
    Could you please give two examples: one where a TT_TINYINT is converted to a BINARY_DOUBLE and one when a TT_BIGINT is converted into a DOUBLE, both cases give examples on lost precision? This would be very helpful.
    Thanks!
    Sune

    chokpa wrote:
    Public Example (float... values){}
    new Example (1, 1e2, 3.0, 4.754);It accepts it if I just use 1,2,3,4 as the values being passed in, but doesn't like it if I use actual float values.Those are double literals, try
    new Example (1f, 1e2f, 3.0f, 4.754f);

  • How can i get the all values from the Property file to Hashtable?

    how can i get the all values from the Property file to Hashtable?
    ok,consider my property file name is pro.PROPERTIES
    and it contain
    8326=sun developer
    4306=sun java developer
    3943=java developer
    how can i get the all keys & values from the pro.PROPERTIES to hashtable
    plz help guys..............

    The Properties class is already a subclass of Hashtable. So if you have a Properties object, you already have a Hashtable. So all you need to do is the first part of that:Properties props = new Properties();
    InputStream is = new FileInputStream("tivoli.properties");
    props.load(is);

  • How to read a tab seperated data from a text file using utl_file

    Hi,
    How to read a tab seperated data from a text file using utl_file...
    I know if we use UTL_FILE.get_line we can read the whole line...but i need to read the tab separated value separately.....
    Thanks in advance...
    Naveen

    Naveen Nishad wrote:
    How to read a tab seperated data from a text file using utl_file...
    I know if we use UTL_FILE.get_line we can read the whole line...but i need to read the tab separated value separately.....If it's a text file then UTL_FILE will only allow you to read it a line at a time. It is then up to you to split that string up (search for split string on this forum for methods) into it's individual components.
    If the text file contains a standard structure on each line, i.e. it is a fixed delimited structure, then you could use external tables to read the data instead.

  • How do I update a bean value from an AJAX call?

    Hi all,
    How do I update a bean value from an AJAX call? I suppose I could write a servlet to do it. However, this seems like a common problem, so I was wondering if there was some built in solution.
    Thanks,
    Grae
    Edited by: caalip2 on Mar 30, 2010 1:07 PM

    caalip2 wrote:
    Raymond
    Basically, I would user the following. The first choice for IE, the second for Firefox.
    new ActiveXObject("Microsoft.XMLHTTP");
    new XMLHttpRequest();
    GraeDon't do this to yourself. If it were that easy there wouldn't be AJAX frameworks for JSF. Find one you like and use it. I've used a4j (part of RichFaces) successfully.

  • How is the largest cde point differs from UTF-8 to UTF-16

    how is the largest cde point differs from UTF-8 to UTF-16
    the largest code point is 10FFFF for both of them then how is differ from the fromat
    thank you,
    Regards,
    Jagrut BharatKumar Shukla

    In this specific case there are no differences for code points storing character data because used character set is the same.
    But what is your Oracle 4 digits version ?
    Are you sure that database character set and national character set are the same ?
    In recent Oracle versions, database character set and national character set are different. For example:
    SQL> select * from nls_database_parameters where parameter like '%SET%';
    PARAMETER                      VALUE
    NLS_CHARACTERSET               AL32UTF8
    NLS_NCHAR_CHARACTERSET         AL16UTF16Edited by: P. Forstmann on 28 sept. 2011 18:51

  • Floating point values

    Hi all;
    Please help.
    I am getting floating point values in my source IDoc like 1.234- but while inserting into the ODS system i need the negative sign before 1.234.
    How to achive this out.
    Nalin

    Hi
    You can achive this by using graphical mapping UUser defined function.
    Mapping source fieldremove context UDF --- target field
    UDF
    for(int i=0;i<Float.length;i++)
    if(Float<i>.endsWith("-"))
    result.addValue("-"+Float<i>.substring(0,Float<i>.length()-1));
    else
    result.addValue(Float<i>);
    Mudit
    Award points if it helps

  • Easiest way to split a floating point value

    Hello, I am trying to split a floating-point value (double) into its fractional and integer parts? I have been trying to find some sort of method in BigDecimal or Double that would do it but so far I haven't come up with anything. I know it could be done by searching through it as a String but that sounds like a very inefficent way to do it. I would appreciate any help you could give. Thanks

    float f;
    int i = (int) f;
    float frac = f-i;

Maybe you are looking for

  • How many playlists can you have or create

    how many playlists can you have or create

  • Why can't I connect to my house wifi?

    I just recently moved to a new house and my macbook pro can't connect to the wifi. Even if it was connected, the page doesnt load. Sometimes it works fine but usually it disconnects. When i try connecting back, it says "connection time out" or "inval

  • Podcast stops every few minutes

    Ever since the podcast app updated last night, my podcasts just stop every few minutes. I tried restarting the phone and playing different podcasts, but it doesn't help. Any suggestions?

  • Html db - confirmation popup

    Hi everyone, I would like a "popup" which is posted when I press on Close button in my page and I've forgotten to record my data. Is this with Javascript which I can create this popup confirmation or HTML-DB offers something in this case ? Thank you

  • Changing directory Structure Problems

    I've created a new Flex Project with a new directory structure that I'm unable to import! No error message, anything...I would like to be more specific, but I have no clue about what's happening...