Using the WRITE Command
Have you ever wanted to sync contacts with your stapler? Maybe not, but the point is, we live in a world of blossoming interconnectivity where you could probably do just that.
In such a connected world, it's increasingly important (and convenient) to keep systems in-touch and in-sync. We've thought about this a lot here at Interactive which is why CueServer has long been "plugged-in" to the internet of things, supporting external communications with devices over an array of protocols such as UDP, serial or telnet.
How about TCP? Well, REST assured that as of CueServer v3.1.1, TCP has joined the list. Today, we're giving you the rundown on the 'WRITE' command and how you can use it to connect to API endpoints on everything from smart-phones to smart-staplers.
If you're looking for the in-depth technical details, take a look at this section of the user's manual.
The write command employs the basic syntax:
Write [port] [string]
[port] parameter can be any of the following:
IP-- UDP to the specified IP over port 52737
IP:PORT-- UDP to the specified IP and port
MULTICAST-IP:PORT-- UDP to multicast group address over the specified port
URL/CURL-- TCP Request to the specified target
[string] parameter is the string to be written to the provided port.
Strings may also include escape characters. See the chart to the right for valid characters.
|Escape Sequence||Hex Value||Character Represented|
||Single quotation mark|
||Double quotation mark|
||Any hexadecimal byte|
||Any octal byte|
Writing to RS-232 & RS-485
Writing to the RS-232 and RS-485 port with the WRITE command is initiated with the
For example, to write the command "SHOW START" over the RS-232 or RS-485 port, you would use:
Write COM1 "SHOW START"
Write COM2 "SHOW START"
If you needed to add a carriage return following the string, you would append a
\r like so:
Write COM1 "SHOW START\r"
Write COM2 "SHOW START\r"
Writing UDP Packets
Writing to UDP is specified by using an IP in the
All UDP messages sent from CueServer are sent over the port 52737 by default when a port number is not specified.
Port numbers are specified by appending a colon
: followed by the desired port number to the IP address.
Writing a directed message is as simple as using the IP you want to direct the message to:
Write "10.0.1.100" "SHOW START" will send the string "SHOW START" via UDP to the IP 10.0.1.100 over port 52737.
Write "10.0.1.100:59999" "SHOW START" will send the string "SHOW START" via UDP to the IP 10.0.1.100 over port 59999.
Writing to multicast is just as simple and just requires swapping in a multicast address. As with a directed UDP message, if unspecified, the message will be sent over port 52737.
Write "220.127.116.11" "SHOW START" will send the string SHOW START via UDP to the IP 18.104.22.168 (the CueServer Multicast Address) over port 52737 (the CueScript Port).
[alert]This message will be received by all CueServers on the network.[/alert]
Write "22.214.171.124:59999" "SHOW START" will send the string SHOW START via UDP to the IP 126.96.36.199 over port 59999.
[alert]This message would be sent to the CueServer Multicast group, but not received as they only listen for CueScript over port 52737.[/alert]
Writing to TCP & Making GET Requests
Making a TCP or GET/POST request with CueServer is slightly different, you specify
CURL as the port, but rather than include the destination in the port argument, you put the entirety of the request into the string argument.
For instance, to make a request to a CueServer via the CGI API, you would use:
Write CURL "http://10.0.1.100/exe.cgi?cmd=cue1go"
Write URL "http://10.0.1.100/exe.cgi?cmd=cue1go"
While the above represents the basic functionality, they are also rather basic requests. The CURL/URL functionality supports all the options included with the Linux cURL command. For instance:
specify a user-agent
Write CURL "--user-agent 'CueServer' http://10.0.1.100/exe.cgi?cmd=ch1afl"
Write CURL "-0 http://10.0.1.100/exe.cgi?cmd=ch1afl"
specify max wait time of 5 seconds
Write CURL "-m 5 http://10.0.1.100/exe.cgi?cmd=ch1afl"
There are many more options, to see what's available, check out the manual for URL/CURL.