# Socket\_read\_string() returning wrong type

**URL:** <https://forum.universal-robots.com/t/socket-read-string-returning-wrong-type/33775>\
**Category:** URScript\
**Created:** [April 18, 2024, 10:58am UTC](https://forum.universal-robots.com/t/socket-read-string-returning-wrong-type/33775 "2024-04-18T10:58:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alessandro\_Gilli](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@Alessandro\_Gilli](https://forum.universal-robots.com/u/Alessandro_Gilli)\
**Post date:** [April 18, 2024, 10:58am UTC](https://forum.universal-robots.com/t/socket-read-string-returning-wrong-type/33775/1 "2024-04-18T10:58:13Z")

</div>

I’m currently reading a value from Cognax camra spreadsheet using the method

```auto
telnet_send("GVL10")

```

and then getting return value and the actual value

```auto
receive = socket_read_string() # status code 
receive = socket_read_string() # actual cell value 

```

and the problem is that when I try to use it in any way I get type error, for example I’ve tryed to convert the value back to a number but I get an error that is not a string stating with or if I try to convert it to string same error that is not a number

```auto
### Read cell value command###
telnet_send("GVL10")
receive = socket_read_string()
	textmsg(receive)
receive = socket_read_string()
	textmsg(receive)

if to_num(receive) == "1.000":
	position = "UP"
end

```

this is the acutal code, where the telnet\_send() function is the one found here

> [@\[SOLVED\] Telnet Comm through socket connection](https://forum.universal-robots.com/t/solved-telnet-comm-through-socket-connection/1372/1):
>
> def telnet\_send(str):  
> socket\_send\_string(str)  
> socket\_send\_byte(13) #send carriage return (CR)  
> socket\_send\_byte(10) #send line feed (LF)  
> end

and this is the resoult that I get from the log

> 1  
> 1.000

---

<div class="post-metadata">

**Author:** ![Alessandro\_Gilli](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@Alessandro\_Gilli](https://forum.universal-robots.com/u/Alessandro_Gilli)\
**Post date:** [April 18, 2024, 2:01pm UTC](https://forum.universal-robots.com/t/socket-read-string-returning-wrong-type/33775/2 "2024-04-18T14:01:07Z")

</div>

I’ve found the solution to my problem, basically I didn’t read the manual very well and I’ve used the socket\_read\_ascii\_float() function worong not formatting the value before passing as following  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/9/90f17793114142981681196a12747f67c0985490.png)
