# Sending floats from the robot controller through TCP/IP?

**URL:** <https://forum.universal-robots.com/t/sending-floats-from-the-robot-controller-through-tcp-ip/120>\
**Category:** URScript\
**Created:** [July 19, 2016, 9:12am UTC](https://forum.universal-robots.com/t/sending-floats-from-the-robot-controller-through-tcp-ip/120 "2016-07-19T09:12:51Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [July 19, 2016, 9:39am UTC](https://forum.universal-robots.com/t/sending-floats-from-the-robot-controller-through-tcp-ip/120/2 "2016-07-19T09:39:54Z")

</div>

Sending a floating point number over TCP socket is not supported by URScript.  
The simplest solution is to multiply the floating point number with e.g. 10000, thus omitting insignificant digits,a nd sending it as an integer.

In example, you could use a URScript function like:

```auto
def getPose():
	p = get_actual_tcp_pose()
	socket_open("127.0.0.1",33000,"ms")
	socket_set_var("myX",p[0]*100000,"ms")
	socket_set_var("myY",p[1]*100000,"ms")
	socket_set_var("myZ",p[2]*100000,"ms")
	socket_close("ms")
end

```

This program would open a socket to `localhost`on port 33000 and send the X, Y and Z data.  
The server would read:

```auto
SET myX 12345
SET myY 23456
SET myZ 34567

```

All would be ASCII chars.

(Valid for URSW 3.3.0.145)

Note:  
Specifically for reading the robot TCP position, consider the [RTDE or client interfaces](http://forum.universal-robots.com/t/communication-interfaces/29) if you have the possibility.

---

_[View the full topic](https://forum.universal-robots.com/t/sending-floats-from-the-robot-controller-through-tcp-ip/120)._
