# TCP socket line terminator

**URL:** <https://forum.universal-robots.com/t/tcp-socket-line-terminator/5806>\
**Category:** URScript\
**Created:** [December 11, 2019, 12:08pm UTC](https://forum.universal-robots.com/t/tcp-socket-line-terminator/5806 "2019-12-11T12:08:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon31418774](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@anon31418774](https://forum.universal-robots.com/u/anon31418774)\
**Post date:** [December 11, 2019, 12:08pm UTC](https://forum.universal-robots.com/t/tcp-socket-line-terminator/5806/1 "2019-12-11T12:08:48Z")

</div>

Hey everyone,

I’m trying to communicate with an external device that has a telnet API.  
The device API is expecting Windows line terminations “\r\n”.  
The urscript socket\_send\_string(…) terminates lines UNIX style “\n”. I get the greeting message and nothing more.

I tested it in Java with a TCP socket communication. The same program works on Windows but gets only the welcome message in Ubuntu and no responses afterwards. I System.setProperty(“line.separator”, “\r\n”) on Ubuntu and it fixed the issue.

Is there any way to change the line terminator in the Polyscope?  
I could write a URCap and handle this issue in Java but it would be a bit overkill for what I need.

Thank you

---

<div class="post-metadata">

**Author:** ![Ebbe](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ebbe/32/1413_2.png) [@Ebbe](https://forum.universal-robots.com/u/Ebbe)\
**Post date:** [December 12, 2019, 7:39am UTC](https://forum.universal-robots.com/t/tcp-socket-line-terminator/5806/2 "2019-12-12T07:39:01Z")

</div>

If your target is to send from URScript to the telnet API. You can use the following sequence:  
socket\_send\_string(…)  
socket\_send\_byte(13)  
socket\_send\_byte(10)  
Wrapping it into a function might be convenient

---

<div class="post-metadata">

**Author:** ![anon31418774](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@anon31418774](https://forum.universal-robots.com/u/anon31418774)\
**Post date:** [December 12, 2019, 2:40pm UTC](https://forum.universal-robots.com/t/tcp-socket-line-terminator/5806/3 "2019-12-12T14:40:34Z")

</div>

That worked great.  
Thanks a lot 🙂

---

<div class="post-metadata">

**Author:** ![cl.lee](https://avatars.discourse-cdn.com/v4/letter/c/5fc32e/32.png) [@cl.lee](https://forum.universal-robots.com/u/cl.lee)\
**Post date:** [October 14, 2024, 6:29am UTC](https://forum.universal-robots.com/t/tcp-socket-line-terminator/5806/4 "2024-10-14T06:29:57Z")

</div>

Looking for solution regarding ascii code command CR LF from UR script to Keyence DL-EN1 product via TCP/IP  
Aside from that,  
socket\_send\_string(“M0”, “socket\_name”)  
socket\_send\_byte(13, “socket\_name”)  
socket\_send\_byte(10, “socket\_name”)
