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
Establishing Connection /


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 the call->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 the call->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 the call->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 the OTListen 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 the TCall structure referenced by the call parameter with information about the connection request. After retrieving the connection request using the OTListen function, you can reject the request using the OTSndDisconnect function, or you can accept the request using the OTAccept function.

If the endpoint is in asynchronous mode or is not blocking, the OTListen function returns any pending connection requests or returns the kOTNoDataErr result if there are no pending connection requests. Typically, you would call the OTListen function from within a notifier function in response to the T_LISTEN event..

SPECIAL CONSIDERATIONS
Not all endpoints support the sending of data with a connection request. Examine the connect field of the TEndpointInfo 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".

Table 4-4.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998