OTGetProtAddress
Obtains the address to which an endpoint is bound and, if the endpoint is currently connected, obtains the address of its peer.C INTERFACE
OSStatus OTGetProtAddress (EndpointRef ref, TBind* boundAddr, TBind* peerAddr)C++ INTERFACE
OSStatus TEndpoint::GetProtAddress (TBind* boundAddr, TBind* peerAddr);PARAMETERS
ref- The endpoint reference of the endpoint whose local and peer address is sought.
boundAddr- A pointer to a
TBindstructure (page 3-51). TheboundAddr->addrfield is aTNetBufstructure that describes the address of the endpoint specified by therefparameter. You must allocate a buffer for the address information and
initialize theaddr.buffield to point to that buffer. You must also initialize theaddr.maxlenfield to the maximum size of
the address.- If you are calling this function only to determine the address of the peer endpoint, you can set the
boundAddrparameter toNIL.- The
boundAddr->qlenfield is ignored.peerAddr- A pointer to a
TBindstructure (page 3-51). If the endpoint specified by therefparameter is currently connected, thepeerAddr->addrfield is aTNetbufstructure that describes
the address of the endpoint's peer. TheboundAddr->qlenfield
is ignored.DESCRIPTION
TheOTGetProtAddressfunction returns the address to which an endpoint is bound in theboundAddrparameter and, if the endpoint is currently connected, the address of its peer in thepeerAddrparameter. Not all endpoints support this function. A value ofT_XPG4_1in theflagsfield of theTEndpointInfostructure indicates that the endpoint does support this function.You are responsible for initializing the buffers required to hold the local and peer addresses. The
addrfield of theTEndpointInfostructure specifies the maximum amount of memory needed to store the address of an endpoint. Use this value to set the size of the buffers.The information returned by the
OTGetProtAddressfunction is affected by the state of the endpoint specified by therefparameter. If the endpoint is in theT_UNBNDstate, theboundAddr->addr.lenfield is set to 0. If the endpoint is not in theT_DATAXFERstate, thepeerAddr->addr.lenfield is set to 0.If the endpoint is in asynchronous mode and a notifier is not installed, it is not possible to determine when the function completes.
COMPLETION EVENT CODES
T_GETPROTADDRCOMPLETE0x20000008 The OTGetProtAddressfunction has completed. Thecookieparameter of the notifier function contains thepeerAddrparameter unless it isnil, in which case thecookieparameter contains theboundAddrparameter.VALID STATES
AllSEE ALSO
TheTBindstructure (page 3-51) describes the address to which an endpoint
is bound.The
flagsfield of theTEndpointInfostructure (page 3-45) indicates whether the endpoint supports this function.For information on how to use this function with a TCP/IP protocol, see page 8-17 in the TCP/IP chapter.
For more information about the peer endpoint, see the description of the
OTAcceptfunction (page 3-127).