background image
C H A P T E R 2 3
Endpoint Interface
23-16
Using the Endpoint Interface
Specifying Flags for Receiving
23
For certain communication tools, it may be necessary to use special protocol flags
when receiving data. You do this by specifying one or more flag constants in the
rcvFlags
slot in the input spec. You can use such flags only if the communication
tool supports them.
For example, some of the built-in communication tools, such as the infrared and
AppleTalk tools, support only framed receiving (packetized data). In order to use
framed receiving, you must set the
rcvFlags
slot to the constant
kPacket
. With
the infrared tool, if you do not specify a
rcvFlags
value of
kPacket
, the tool
will behave unexpectedly.
Do not define the
rcvFlags
slot if the underlying communication tool does not
support EOP indicators. If you do so, your input will terminate after each physical
buffer of data is received. If you wish to terminate an input spec based on an EOP
indicator, set the
useEOP
slot in the
termination
frame to
true
.
Of the built-in communication tools, only the infrared, AppleTalk, and framed
asynchronous serial tools support framed packets and the
kPacket
flag.
If you set the
kPacket
flag and set the
useEOP
slot to
true
, you cannot also use
the
byteCount
slot in the termination frame--if you do,
byteCount
will be
ignored. In this case, only an EOP indicator will terminate input. If you do want to
use the
byteCount
slot with the
kPacket
flag, set the
useEOP
slot to
nil
. In
the latter case, the remote system should send an EOP indicator with every packet,
though input won't terminate until the
byteCount
condition is met.
Specifying an Input Time-Out
23
You can specify a time-out for input in the
reqTimeout
slot of the input spec. In
this slot, you specify the time, in milliseconds, of inactivity to allow during input.
If there is no input for the specified interval, the time-out expires, the input is
terminated, and the
CompletionScript
message is sent to the input spec frame.
In this case, the result code passed with the
CompletionScript
message
is ­16005.
Don't specify a
reqTimeout
value less than 30 milliseconds.
Note that if a time-out expires for an asynchronous request such as receiving, that
request and all outstanding requests are canceled.
Specifying Data Filter Options
23
As incoming data is received in the input buffer, the data can be processed, or
filtered. This filtering can occur on all types of received data, except binary data
(defined by the
'binary
data form). This filtering of data is defined by the
filter
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна