Important: The information in this document is obsolete and should not be used for new development.
OTGetProtAddress
Obtains the address to which an endpoint is bound and, if the endpoint is currently connected, also obtains the address of its peer.C INTERFACE
OSStatus OTGetProtAddress(EndpointRef ref, TBind* boundAddr, TBind* peerC++ 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
TBind
structure. TheboundAddr->addr
field is aTNetBuf
structure that returns the address of the endpoint specified by theref
parameter. You must allocate a buffer for the address information and initialize theboundAddr.buf
field to point to that buffer. You must also initialize theboundAddr.maxlen
field to the size of the address buffer.- If the endpoint is in the
T_UNBND
state, the fieldboundAddr->addr.len
field is set to 0.- If you are calling this function only to determine the address of the peer endpoint, you can set the
boundAddr
parameter toNIL
.- The
boundAddr->qlen
field is ignored.peerAddr
- A pointer to a
TBind
structure. If the peer endpoint is currently connected or is in theT_DATAXFER
state, thepeerAddr->addr
field (aTNetbuf
structure) returns the address of the endpoint's peer.- If you are calling this function only to determine the address to which the endpoint is bound, you can set the
pperAddr
parameter tonil
.- The
peerAddr->qlen
field is ignored. If the endpoint is not connected or in theT_DATAXFER
state, thepeerAddr->addr.len
field is set to 0 and thepeerAddr->addr.buf
pointer may be set toNULL
.- function result
- An error code. See Discussion.
DISCUSSION
TheOTGetProtAddress
function returns the address to which an endpoint is bound in theboundAddr
parameter and, if the endpoint is currently connected, it returns the address of its peer in thepeerAddr
parameter. Not all endpoints support this function. If theT_XPG4_1
bit in theflags
field of theTEndpointInfo
structure is not set, the endpoint does not support this function.You are responsible for allocating the buffers required to hold the local and peer addresses. The
addr
field of theTEndpointInfo
structure specifies the maximum amount of memory needed to store the address of an endpoint. Use this value as the size of the buffers.If the endpoint is in synchronous mode, the function returns when the operation is complete. If the endpoint is in asynchronous mode and a notification routine is installed, the function returns
kOTNoError
and the provider sends the event codeT_GETPROTADDRCOMPLETE
, when the operation completes. Theresult
parameter iskOTNoError
if the function succeeded or a negative error code if it did not. Thecookie
parameter sent to the notification routine contains thepeerAddr
value unless that isNULL
. If thepeerAddr
value wasNULL
, thecookie
parameter contains theboundAddr
value instead. If a notifier is not installed, it is not possible to determine when the function completes. For more information on notifier codes and event codes, seeMyNotifierCallback
function and "Event Codes".SEE ALSO
TheOTAccept
function.