Listens for an incoming connection request.
OTListen
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
TCallstructure (page 3-62) that contains 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.DESCRIPTION
You use theOTListenfunction to listen for incoming connection requests. On return, the function fills in theTCallstructure referenced by thecallparameter with information about the connection request. After retrieving the connection request using theOTListenfunction, you can reject the request using theOTSndDisconnectfunction, or you can accept the request using theOTAcceptfunction.If the endpoint is in synchronous mode and is blocking, the
OTListenfunction returns when a connection request has arrived. If the endpoint is in asynchronous mode or is not blocking, theOTListenfunction returns any pending connection requests or returns thekOTNoDataErrresult if there are
no pending connection requests. You can also call theOTListenfunction from within a notifier function in response to theT_LISTENevent. In this case, the function returns a result immediately.SPECIAL CONSIDERATIONS
Not all endpoints support the sending of data with a connection request. Examine theconnectfield of theTendpointInfostructure for the endpoint to determine if the endpoint supports the sending of data and to determine the maximum size of the data.To ensure portability, do not explicitly bind the endpoint to which you are passing off a connection if its address is to be the same as that of the endpoint listening for connection requests.
VALID STATES
T_IDLE,T_INCONSEE ALSO
You use theOTAcceptfunction (described next) to read an incoming connection request that you have retrieved using theOTListenfunction.You use the
TCallstructure (page 3-62) to store 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 use the
OTSndDisconnectfunction (page 3-149) to reject a connection request.You specify the maximum number of outstanding connections for an endpoint when you bind the endpoint using the
OTBindfunction (page 3-77).For information on how to use this function with a TCP/IP protocol, see page 8-18 in the TCP/IP chapter.
For information on how to use this function with AppleTalk protocols, see page 13-11 in the ADSP chapter and page 15-10 in the PAP chapter.
You examine the
connectfield of theTEndpointInfostructure (page 3-48) to determine whether your endpoint supports the sending of data with a connection request.