309
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
dissolved. To the receiving TCP socket or serial port, the data appears to be a
stream.
Sinking Data
Sometimes it is desirable to ignore all incoming data while still maintaining the
connection opened. The
property allows you to do just that.
Set the sock.sinkdata to 1- YES, and all incoming data will be automatically
discarded. This means that the
event will not be
generated, reading
will always be returning zero, and so on. No data
will be reaching its destination even in case of
, however, will still be extracted from the incoming data stream and
processed.
and
will work correctly as
well.
Working With Inband Commands
Inband commands (replies) are messages embedded within the TCP data stream.
Each inband message has a specific formatting that allows the socket to recognize
it in the data stream being received.
Inband messages have many uses. For example, in a network-to-serial converter,
you typically pass all serial data through a single TCP connection. At the same
time, you often need to send some control commands to the device, i.e. for setup,
etc. This can be done in two ways: through a separate network connection ("out-
of-band" respective to the main data connection) or by embedding those
commands inside the serial data stream ("inband" way). The second method is
sometimes better, since very often you want to avoid or cannot have another
network connection to your device.
Of course, you could just write a BASIC code that would be separating inband
commands from the data but this would affect the performance (data throughput)
of your device considerably. The sock object natively supports inband commands
to avoid this performance penalty. In fact, inband commands will work even when
the
is enabled!
Inband messages are only possible with TCP transport protocol. You
cannot use inband messages with UDP!
Inband Message Format
Inband message passing is enabled through the
property.
Each inband message has to start with a special escape character whose ASCII
code is specified by the
property. The next character after the
escape character can have any ASCII code except for the code of the escape
character itself.
Following that is the body of the inband message. The last character in the
message is a so-called end character, specified by the
property. It
signals the end of the inband message and return to the "regular" data.
There are no specific limitations on how long the inband message can be. The
length is only limited by how much space you allocate for the
that store incoming and outgoing inband messages.
And what if the data stream itself contains a character(s) with the ASCII code of
the escape character you have set? Wouldn't this confuse the socket into thinking
that this is the beginning of inband command? To avoid this situation, the data
354
342
352
308
309
330
360
308
337
332
331
310