312
Platforms
©2000-2008 Tibbo Technology Inc.
...
sock.inbandcommands= YES
sock.escchar=`@`
sock.endchar=`
&
`
...
Here is a sample data stream:
Data@command1&Moredata@!command2&Evenmoredata
This incoming data stream will have the following effect:
The RX buffer will receive this data: "DataMoredataEvenmoredata".
The CMD buffer will receive: "ommand1&command2&"
Notice, that the first inband command is missing the first character- this is because
when the inband command is being processed both its escape character and the
character following the escape character are removed. End characters of both
inband commands are preserved so you can tell where each one ends.
Extracting the data from the CMD buffer
Extracting data from the CMD buffer is similar to extracting data from the RX
buffer. A dedicated method-
- does the job. This method is just
like the
, minus the maxinplen argument. Total amount of data in
the CMD buffer can be checked through the
property.
Once extracted, the data is no longer in the buffer. You can use the
property to check how much data is waiting in the CMD buffer. There is no
dedicated property to tell you the buffer capacity- just remember what the
method returned if you have to know this!
event is generated whenever there is some data in the
CMD buffer, but only once. There are never two on_sock_inband events waiting in
the queue. The next event is only generated after the previous one has completed
processing, if and when there is any data available in the CMD buffer.
Inband commands only appear in the CMD buffer in their entirety. That is, if the
buffer was previously empty and you get the on_sock_inband event then you are
guaranteed that the buffer will contain a full command (or several full commands).
Here is an example:
334
333
329
329
329
343