HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)

t
t_bind(3) t_bind(3)
If fd refers to a connection-mode service, this function allows more than one transport endpoint to be
bound to the same protocol address (however, the transport provider must also support this capability),
but it is not possible to bind more than one protocol address to the same transport endpoint. If a user
binds more than one transport endpoint to the same protocol address, only one endpoint can be used to
listen for the connect indications associated with that protocol address. In other words, only one
t_bind() for a given protocol address may specify a value of qlen greater than zero. In this way, the
transport provider can identify which transport endpoint should be notified of an incoming connect indi-
cation. If a user attempts to bind a protocol address to a second transport endpoint with a value of qlen
greater than zero,
t_bind() will return 1 and set
t_errno to [TADDRBUSY] (XTI) or [TBADADDR]
(TLI). When a user accepts a connection on the transport endpoint that is being used as the listening
endpoint, the bound protocol address will be found to be busy for the duration of the connection, until a
t_unbind() or t_close() call has been issued. No other transport endpoints may be bound for
listening on the same protocol address while that initial listening endpoint is active (in the data transfer
phase or in the T_IDLE state). This will prevent more than one transport endpoint bound to the same
protocol address from accepting connect indications.
If fd refers to a connectionless-mode service, only one endpoint may be associated with a protocol address.
If a user attempts to bind a second transport endpoint to an already bound address,
t_bind() will
return 1 and set
t_errno to [TADDRBUSY].
Thread-Safeness
The
t_bind() function is safe to be called by multi-threaded applications, and it is thread-safe for both
POSIX Threads and DCE User Threads. It has a cancellation point. It is neither async-cancel safe nor
async-signal safe. Finally, it is not fork-safe.
Valid States
T_UNBND
Note
HP XTI does not support automatic generation of addresses. Therefore a valid local transport address
must be specified in req.
Caveats
The requirement that the value of qlen never be negotiated from a requested value greater than zero to
zero implies that transport providers, rather than the XTI implementation itself, accept this restriction.
A transport provider may not allow an explicit binding of more than one transport endpoint to the same
protocol address although it allows more than one connection to be accepted for the same protocol
address. To ensure portability, it is, therefore, recommended not to bind transport endpoints that are
used as responding endpoints (resfd) in a call to t_accept() if the responding address is to be the
same as the called address.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a value of 1 is returned and
t_errno
is set to indicate the error.
ERRORS
On failure,
t_errno is set to one of the following:
[TBADF] The specified file descriptor does not refer to a transport endpoint.
[TOUTSTATE] The function was issued in the wrong sequence.
[TBADADDR] The specified protocol address was in an incorrect format or contained illegal infor-
mation.
[TNOADDR] The transport provider could not allocate an address.
[TACCES] The user does not have permission to use the specified address.
[TBUFOVFLW] The number of bytes allowed for an incoming argument is not sufficient to store the
value of that argument. The provider’s state will change to
T_IDLE and the infor-
mation to be returned in ret will be discarded.
[TSYSERR] A system error has occurred during execution of this function.
[TADDRBUSY] The address requested is in use and the transport provider could not allocate a new
address.
HP-UX 11i Version 2: September 2004 2 Hewlett-Packard Company Section 31049