Out-of-Band (UDP) Programming
With out-of-band UDP programming commands and replies are sent as UDP datagrams, one command or reply per datagram. As explained in network programming the DS accepts commands on two UDP ports- 65535 and 32767. Reply to a particular command is always sent to the IP-address and the port number from which this command was received.
Because each command and reply is sent in a separate UDP datagram no additional encapsulation (i.e. using STX and CR characters as in serial command/replies ) is necessary.
Example: here is a sample exchange between the network host and the DS. Each line represents the data in a separate UDP datagram.
Host-->DS: SBR4
DS-->Host: A
One additional feature supported by the DS is the ability to receive and process multiple out-of-band commands. The network host can send up to eight such commands and the DS will receive and process them all one-by-one. This dramatically increases the speed with which the DS programming can be performed over the network.
Since delivery of UDP packets is not guaranteed and packets can also arrive out-of-order the DS supports an optional command ID field. This field can be up to four ASCII characters long and contain any characters in the 0-9 and A-z range. ID field is added in the end of the command itself, '|' character (ASCII code 166) is used as a separator. When the DS receives a command that contains the ID field it issues the reply with the same ID field at the end. By sending commands with changing command ID the network host can match commands and replies.
Example: here is a sample exchange of two commands and replies between the network host and the DS. Each line represents the data in a separate UDP datagram. Replies arrive out of order but owing to the ID field the network host can still match each reply to its respective command.
Host-->DS: SBR4|1923
Host-->DS: SPR0|1924
DS-->Host: A|1924
DS-->Host: A|1923
Once again, the ID field is added at the end of all command data, which includes all command fields (mandatory or optional) described for individual commands. For example, Parameter (P) command can have an optional password field so command ID is added past this field (when it is present):
Host-->DS: PBR4/123pwd|1925
In the above example the password is "123pwd".