Apple Newton Utilities Guía de usuario Pagina 800

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 942
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 799
CHAPTER 22
Transport Interface
22-12 Using the Transport Interface
Handling Requests When the Transport Is Active 22
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 nished.
You can use the transport method
QueueRequest to queue up requests for
sending or receiving, if the transport already has an active communication session
in progress. Call
QueueRequest from the SendRequest or ReceiveRequest
method, whichever one you receive as a result of a user request.
Depending on how you call it, you can make
QueueRequest append the new
request to a request in progress or start another connection when the current
request is nished. To append the new request to one in progress, for the rst
parameter, specify the request frame of a request already in progress. A request
frame is the frame passed to
SendRequest or ReceiveRequest to begin the
request in progress. The second parameter is the new request frame.
The following is an example of a
SendRequest method in which
QueueRequest is called to append the new request to the one in progress.
// SendRequest method
func (newRequest)
begin
if status <> 'idle then // check if I’m active
// append to current request
:QueueRequest(currentRequest, newRequest);
else
// do a normal send here
end,
When a new request is appended to an in-progress request, items from the new
request are returned from the
ItemRequest 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 nishes its current transaction before
beginning a new one, specify a symbol for the rst parameter of
QueueRequest.
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
SendRequest or
ReceiveRequest method. The following is an example of a SendRequest
method in which
QueueRequest is called to defer a new request until the
transport returns to the idle state.
Vista de pagina 799
1 2 ... 795 796 797 798 799 800 801 802 803 804 805 ... 941 942

Comentarios a estos manuales

Sin comentarios