URScript 3.12 socket_read_string reads multiple strings?

I was curious what this did too so I wrote a simple server and a test program in Polyscope.

Here is the server that I wrote in node.js:

"use strict";
var net = require("net");

let server = net
  .createServer((sock) => {
    sock.on("connect", (data) => {});

    sock.on("data", (data) => {
      console.log(data.toString());
      sock.write(">Hello<>World<");
    });
  })
  .listen(2115);

Here is the Polyscope program that connects and reads from the server

What this does is actually set var_1 to “Hello” and var_2 to “World”. So basically with a single send from the server I am able to get set the value of multiple variables from that single server write. So just playing around I changed the command that was written back from the server to sock.write(">Hello<>World<>from<>node<") and then added two more variables and this is what I get now

image

Hope that helps clarify what is going on and I learned something new today myself!

1 Like