Important: The information in this document is obsolete and should not be used for new development.
OTAsyncOpenEndpoint
Opens an endpoint and installs a notifier callback function for the endpoint.C INTERFACE
OSStatus OTAsyncOpenEndpoint( OTConfiguration* config, OTOpenFlags oflag, TEndpointInfo* info, OTNotifyProcPtr proc, void* contextPtr);C++ INTERFACE
None. C++ applications use the C interface to this function.PARAMETERS
config- A pointer to an endpoint configuration structure that specifies the endpoint's characteristics. You obtain a value for the
configparameter by calling theOTCreateConfigurationfunction. TheOTAsyncOpenEndpointfunction disposes of the configuration structure before returning.oflag- Reserved; must be set to 0.
info- A pointer to a
TEndpointInfostructure to be filled in by theOTAsyncOpenEndpointfunction. SpecifyNULLfor this parameter if you do not want theOTAsyncOpenEndpointfunction to return endpoint information.proc- A pointer to a notifier callback function for this endpoint. If you do not provide a notifier function, your application cannot receive completion events, including the event advising you that the endpoint has been created. Never pass a universal procedure pointer as the
procparameter.contextPtr- A pointer for your use. The endpoint passes this pointer value when calling the notifier function you specify in the
procparameter. You might use thecontextPtrparameter to pass your notifier function information about the endpoint, for example.- function result
- An error code. See Discussion.
DISCUSSION
TheOTAsyncOpenEndpointfunction opens an endpoint having the characteristics specified by theconfigparameter. How processing proceeds depends on this result code.If the result code is any except
kOTNoError, an error occurred and Open Transport does not queue the function for execution. TheOTAsyncOpenEndpointfunction creates no endpoint and does not call the notifier function that you specified in theprocparameter.If the result code is
kOTNoError, theOTAsyncOpenEndpointfunction has queued the operation for execution. When it completes it calls the notifier function that you specified in theprocparameter, passing the eventT_OPENCOMPLETEfor thecodeparameter, a result code in theresultparameter, and the endpoint reference for the newly created endpoint in thecookieparameter. For information about notifier functions, see "Application-Defined Notifier Functions" and "Event Codes".An endpoint created by the
OTAsyncOpenEndpointfunction operates in asynchronous mode, does not block, and does not acknowledge sends. To change these default settings, you can call theOTSetSynchronousfunction,OTSetBlockingfunction and theOTAckSendsfunction.The initial state of an endpoint is
T_UNBND, meaning that the endpoint is not bound to a protocol address. Before using the endpoint to transfer data, you must bind it to a protocol address by calling theOTBindfunction.SPECIAL CONSIDERATIONS
The first time you open a provider of any kind, Open Transport allocates needed resources at system task time, calling theScheduleSystemTaskfunction to do this. To allow this processing to take place, you need to callSystemTaskorWaitNextEventfrom a foreground task while waiting for the endpoint to be created.The
OTAsyncOpenEndpointfunction disposes of the configuration structure returned by theOTCreateConfigurationfunction. If you want to use the same configuration to open additional endpoints, you must obtain a valid copy of the configuration structure by calling theOTCloneConfigurationfunction before you call theOTAsyncOpenEndpointfunction. For more information, see "Configuring and Opening a Provider".SEE ALSO
TheOTOpenEndpointfunction.