Home Programming

Discussion

Left ArrowBack to discussions page
PrasannaPrasanna Posts: 56 Apprentice
Hi @matthewd92
Am having issues with socket read command.
i need to receive (Pass,2.33,5.55, ok)
but if I use socket_read_string (), I cannot receive anything and cannot indexable as well
if I use socket_read_ascii-float() cannot read characters
If I use socket_read _line () received nothing.

please let me know the format
Tagged:

Comments

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
    String needs to be passed as a string, you could then use the string tools that UR provides to parse the string and get the various values you need.  Same with read line, still looking for a single line.  read_ascii_float will only work with numbers, cannot pass text through that method.

    For example:

    Here is a program where I received back the data like you were asking for, it's stored in the variable originalMessage and then I parse it to get the 4 values that you are sending.  I also convert values 2 and 3 to numbers.


    Notice that on my server I excluded any white spacing from the string that was sent following the commas, this was so that I did not have to deal with getting rid of the white space even though if you knew it was there you could handle it.
Sign In or Register to comment.
Left ArrowBack to discussions page