t_getprotaddr -- get protocol addresses


cc [options] file -lnsl
#include <xti.h>

int t_getprotaddr(int fd, struct t_bind *boundaddr, struct t_bind *peeraddr);


This function is an TLI/XTI local management function used to get protocol addresses for both the local and remote endpoints. t_getprotaddr returns, for the transport endpoint specified by fd, the local address of the transport endpoint (pointed to by boundaddr) and the remote address of the peer (pointed to by peeraddr).

The local address is available if the endpoint is bound (not in the T_UNBND state) and the peer address is available if the endpoint is in the T_DATAXFER state.


File descriptor for the transport endpoint associated with the protocol address.

Points to the bound address of the local transport endpoint.

Points to the peer address.

Structure definitions

boundaddr and peeraddr point to a t_bind structure containing the following members:
   struct netbuf addr;	/* address */
   unsigned qlen;		/* connect indications */
The netbuf addr members (len, maxlen and buf) are described in intro(NET). len specifies the number of bytes in the address, buf points to the address buffer, and maxlen is the maximum size of the address buffer. qlen, in connection mode only, is used to indicate the maximum number of outstanding connect indications.

In boundaddr and peeraddr, maxlen is the maximum size of the address buffer, specified by the user, and buf points to the buffer where the address will be placed.

On return, if the endpoint specified by fd is currently bound, the buf field of boundaddr points to the address of the transport endpoint and len indicates the length of the address. If the endpoint is not bound, the len member of boundaddr returns a value of 0.

If the transport user is in the T_DATAXFER state, the buf member of peeraddr points to the address of the peer (currently connected to fd and the len member indicates the length of that address. If the endpoint is not connected, the len member of peeraddr returns a value of 0.

State transitions

t_getprotaddr may be issued from any valid state except T_UNINIT and has no effect on the state.


X/Open® Transport Interface Library (shared object)

Network Services Library (shared object)


This function is applicable for both connection-mode and connectionless transport services. However, since the remote endpoint is never in the TDATAXFER state if the service is connectionless, only the address of the bound endpoint will be returned.

Return values

t_getprotaddr returns a value of 0 on successful completion and -1 on failure and t_errno is set to indicate the error.


On failure, t_errno may be set to one of the following:

The specified file descriptor does not refer to a transport endpoint.

The number of bytes (maxlen) allocated for an incoming argument is greater than zero but not sufficient to store the value of that argument.

A system error has occurred during execution of this function.

A communication problem has been detected with the transport provider and there is no other value of t_errno to describe the error condition.


intro(NET), t_accept(NET), t_bind(NET), t_connect(NET)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005