Universal Robots Forum

TCP socket line terminator

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

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

That worked great.
Thanks a lot :slight_smile: