Important: The information in this document is obsolete and should not be used for new development.
OTListen
Listens for an incoming connection request.C INTERFACE
OSStatus OTListen(EndpointRef ref, TCall* call);C++ INTERFACE
OSStatus TEndpoint::Listen(TCall* call);PARAMETERS
ref
- The endpoint reference of the endpoint listening for the connection request.
call
- A pointer to a
TCall
structure that contains, on return, information about the address of the peer requesting the connection, option information, data associated with the connection request, and the connection ID for this connection. You must allocate buffers in which this information can be stored and specify the maximum length for each buffer.
- The
call->addr.buf
field points to a buffer that will hold the address of the endpoint that requested the connection. Set thecall->addr.maxlen
field to the size of the buffer.
- The
call->opt.buf
field points to a buffer that will hold the options that the peer has requested for this connection. Set thecall->opt.maxlen
field to the size of the buffer.
- The
call->udata.buf
field points to a buffer that stores any data sent by the endpoint requesting the connection. Set thecall->udata.maxlen
field to the maximum size of this buffer.
- The
call->sequence
field contains the connection ID of the incoming request.
- function result
- An error code. See Discussion.
DISCUSSION
You use theOTListen
function to listen for incoming connection requests.If the endpoint is in synchronous mode and is blocking, the
OTListen
function returns when a connection request has arrived. On return, the function fills in theTCall
structure referenced by thecall
parameter with information about the connection request. After retrieving the connection request using theOTListen
function, you can reject the request using theOTSndDisconnect
function, or you can accept the request using theOTAccept
function.If the endpoint is in asynchronous mode or is not blocking, the
OTListen
function returns any pending connection requests or returns thekOTNoDataErr
result if there are no pending connection requests. Typically, you would call theOTListen
function from within a notifier function in response to theT_LISTEN
event..SPECIAL CONSIDERATIONS
Not all endpoints support the sending of data with a connection request. Examine theconnect
field of theTEndpointInfo
structure for the endpoint to determine if the endpoint supports the sending of data and to determine the maximum size of the data.SEE ALSO
"AppleTalk Reference".