Socket timeouts

Is there a way to change the default timeout (2 seconds) on socket IO functions? For example, socket_read_string(timeout=0.1) does not work.

Cheers

It is currently (applies to SW 3.4.1 and earlier) not possible to change the timeout of URScript socket commands.

If you require more extensive socket command functionality, it could be an option to use XML-RPC or for that matter socket communications to a local daemon in the controller. This daemon could convert the internal comms (URScript to daemon) to the external communication (daemon to ext. device), and hence for this communication, you could have the full socket functionality to the external device, depending on the daemon language of your choosing.

Thanks for the reply. Do you know where I can find some detailed documentation about writing and setting up a local daemon on the controller?

The MyDaemon sample enclosed in the SDK, and the XML-RPC sample URCap in this forum both emulates setting up a daemon.

Hi all,

since version 5.11 the timeout for socket commands works like a sharm. Read the Documentation for more details please :wink:

An XML-RPC implementation is therefore not necessary for most use cases i suppose.

Here is a code example how I use it when I don’t want to run into a timeout error. The program then waits until I have received an answer:

local answer = socket_read_line(device, timeout=-1)

For timeout after 5 secs:

local answer = socket_read_line(device, timeout=5.0)