Apple Newton Utilities Guide de l'utilisateur Page 839

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 942
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 838
CHAPTER 23
Endpoint Interface
Using the Endpoint Interface 23-11
When you are nished with an endpoint, you must unbind it using the UnBind
method, then dispose of it using the
Dispose method.
Establishing a Connection 23
After instantiating and binding an endpoint, you establish a connection.
There are two ways you can create a connection. One way is to call the
Connect
method. If the physical connection is serial, for instance, you don't even need to
specify an address as an option. The
Connect method immediately establishes
communication with whatever is at the other end of the line.
Certain communication tools—for example, the modem and AppleTalk tools—
require you to specify an option of type
'address in order to make a connection.
The modem tool requires a phone number as an
'address option. You should
use the global function
MakePhoneOption to return a proper phone number
'address option. The AppleTalk tool requires an AppleTalk Name Binding
Protocol (NBP)
'address option. You should use the global function
MakeAppleTalkOption to return a proper NBP 'address option.
To establish a connection where you expect someone else to initiate the connection,
you need to call the
Listen method. Once the connection is made by using
Listen, you need to call the Accept method to accept the connection, or the
Disconnect method to reject the connection and disconnect.
Sending Data 23
To send data, use the Output method. This method is intelligent enough to gure
out the type of data you're sending and to convert it appropriately for transmission.
This is because NewtonScript objects have type information embedded in their
values, allowing the system to select appropriate default data forms for different
kinds of data being sent.
You can specify output options and a callback method by dening an output spec,
which you pass as a parameter to the
Output method.
Certain communication tools may require or support the use of special ags
indicating that particular protocols are in use. For example, the built-in infrared and
AppleTalk tools expect framed (or packetized) data, and there are special ags to
indicate that this kind of protocol is in use. If you are using such a communication
tool to send data, you need to specify the
sendFlags slot in the output spec
frame. In this slot, you specify one or more ag constants added together.
To send packetized data, you set
sendFlags to kPacket+kMore for each packet
of data that is not the last packet. For the last packet, set
sendFlags to
kPacket+kEOP.
Vue de la page 838
1 2 ... 834 835 836 837 838 839 840 841 842 843 844 ... 941 942

Commentaires sur ces manuels

Pas de commentaire