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.
DESCRIPTION
You use theOTLookfunction in one of two cases. First, if the endpoint is in synchronous mode, you can call theOTLookfunction to poll for incoming data or connection requests. Second, certain asynchronous events might cause a synchronous function to fail with the resultkOTLookErr. For example, if you callOTAcceptand the endpoint gets aT_DISCONNECTevent, theOTAcceptfunction returns withkOTLookErr. In this case, you need to call theOTLookfunction to determine what event caused the original function to fail. Table 3-7 on page 3-25 lists the functions that might return thekOTLookErrresult and the events that can cause these functions to fail.The
OTLookfunction returns an integer value that specifies the asynchronous event pending for the endpoint specified by therefparameter. On error,OTLookreturns a negative integer corresponding to a result code.If there are multiple events pending, the
OTLookfunction first looks for one of the following events:T_LISTEN,T_CONNECT,T_DISCONNECT,T_UDERR, orT_ORDREL. If it finds more than one of these, it returns them to you in first-in, first-out order. After processing these events, theOTLookfunction looks for theT_DATA,T_REQUEST,andT_REPLYevents. If it finds more than one of these, it returns them to you in first-in, first-out order. You cannot use theOTLookfunction 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.
VALID STATES
AllSEE ALSO
For additional information on asynchronous processing and on handling asynchronous and completion events, see the section "Handling Events for Endpoints," beginning on page 3-22 and the chapter "Providers" in this book.Table 3-7 on page 3-25 lists the functions that might return the
kOTLookErrresult and the events that can cause these functions to fail.The reference section of the chapter "Providers" in this book lists values returned for pending asynchronous events and describes their meanings.
For information on how to use this function with a TCP/IP protocol, see page 8-16 in the TCP/IP chapter.
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help