Request Types

Every client request consists of a command which, depending on the command, may be followed by arguments and/or data.

There are four types of client requests:

Commands are in upper case. Arguments and data may be in mixed case

Commands and arguments are separated by a space character

Simple Commands

Examples of simple commands are PING, INFO and PROCESSID. The command is followed by "\r\n" (CRLF), eg:

PING\r\n

Single-line Commands

GET is a good example of a single-line command. The command is followed by an argument and terminated with "\r\n" (CRLF)

GET myArray["1","2"]\r\n

Two-line Commands

SET is a good example of a single-line command. The command is followed by two arguments and terminated with "\r\n" (CRLF). This is followed by a single line of data, terminated with "\r\n" (CRLF). The last argument on the command line specifies the number of bytes of data in the second line, eg:

SET myArray["1","2"] 11\r\n
hello world\r\n

Multi-line Commands

SETSUBTREE is a good example of a mutil-line command. The command is followed by one argument and terminated with "\r\n" (CRLF). This is followed by multiple data lines that are defined as follows:

For example:

SETSUBTREE myArray["1","2"]\r\n
*6\r\n
$7\r\n
"a","b"\r\n
$12\r\n
Hello World!\r\n
$7\r\n
"a","c"\r\n
$-1\r\n
$11\r\n
"a","b",123\r\n
$6\r\n
123.45\r\n

In the example above, the *6 denotes that 6 records follow. The first consists of 7 bytes (denoted by the $7), the value of the record being "a","b".

Note that the fourth record is a null record, denoted by just a single line: $-1, so the next line ($11) defines the number of bytes in the fifth record.