Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Networking With Open Transport / Part 2 - Open Transport Reference
Chapter 22 - Endpoints Reference / Functions
Obtaining Information About an Endpoint /


OTLook

Determines the current asynchronous event pending for an endpoint.

C INTERFACE
OTResult OTLook(EndpointRef ref);
C++ INTERFACE
OTResult TEndpoint::Look();
PARAMETERS
ref
The endpoint reference of the endpoint.
function result
A positive value specifying the pending asynchronous event, or a negative number corresponding to an error result code. For a list of result codes, See Appendix B.
DISCUSSION
This function returns the current pending asynchronous event on the endpoint. The function returns immediately, regardless of whether the endpoint is in synchronous or asynchronous mode.

You use the OTLook function in one of two cases. First, if the endpoint is in synchronous mode, you can call the OTLook function to poll for incoming data or connection requests. Second, certain asynchronous events might cause a function to fail with the result kOTLookErr. For example, if you call OTAccept and the endpoint gets a T_DISCONNECT event, the OTAccept function returns with kOTLookErr. In this case, you need to call the OTLook function to determine what event caused the original function to fail. Table 4-8 lists the functions that might return the kOTLookErr result and the events that can cause these functions to fail.

IMPORTANT
The OTLook function can actually clear certain asynchronous events, specifically the T_GODATA and the T_GOEXDATA events. If you consume one of these events by calling OTLook, you will not be notified of that type of event until you are flow controlled again.
If there are multiple events pending, the OTLook function first looks for one of the following events: T_LISTEN, T_CONNECT, T_DISCONNECT, T_UDERR, or T_ORDREL. If it finds more than one of these, it returns them to you in first-in, first-out order. After processing these events, the OTLook function looks for the T_DATA, T_REQUEST, and T_REPLY events. If it finds more than one of these, it returns them to you in first-in, first-out order. You cannot use the OTLook function to poll for completion events.

Unless you are operating exclusively in synchronous mode, it is recommended that you use notifier functions to get information about pending events for an endpoint, rather than using the OTLook function.

SEE ALSO
"Handling Events for Endpoints".

"Event Codes".

"Application-Defined Notifier Functions".

Table 4-4 .


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998