C H A P T E R 2 2
Using the Transport Interface
Handling Requests When the Transport Is Active
While the transport is actively sending or receiving data in the background, the user
might request another send or receive operation from the In/Out Box. One way to
handle such requests is to queue them up and append them to the current communi-
cation transaction or to start another connection when the transport is finished.
You can use the transport method
to queue up requests for
sending or receiving, if the transport already has an active communication session
in progress. Call
method, whichever one you receive as a result of a user request.
Depending on how you call it, you can make
append the new
request to a request in progress or start another connection when the current
request is finished. To append the new request to one in progress, for the first
parameter, specify the request frame of a request already in progress. A request
frame is the frame passed to
to begin the
request in progress. The second parameter is the new request frame.
The following is an example of a
method in which
is called to append the new request to the one in progress.
// SendRequest method
if status <> 'idle then // check if I'm active
// append to current request
// do a normal send here
When a new request is appended to an in-progress request, items from the new
request are returned from the
method after all items from the
in-progress request are exhausted. In this way, new items are sent as part of the
current communication session.
To queue a new request so that the transport finishes its current transaction before
beginning a new one, specify a symbol for the first parameter of
The symbol should be the name of a method that you want the system to call when
the transport state returns to idle. Usually this is another
method. The following is an example of a
method in which
is called to defer a new request until the
transport returns to the idle state.