Establishes a connection with another transport user.
Transport Layer Interface Library (libtli.a)
#include <tiuser.h>
int t_connect(fd, sndcall, rcvcall) int fd; struct t_call *sndcall; struct t_call *rcvcall;
The t_connect subroutine enables a transport user to request a connection to the specified destination transport user.
The sndcall and rcvcall parameters point to a t_call structure that contains the following members:
struct netbuf addr; struct netbuf opt; struct netbuf udata; int sequence;
The netbuf structure is described in the tiuser.h file. In the sndcall parameter, the addr field specifies the protocol address of the destination transport user, the opt field presents any protocol-specific information that might be needed by the transport provider, the udata field points to optional user data that may be passed to the destination transport user during connection establishment, and the sequence field has no meaning for this function.
On return to the rcvcall parameter, the addr field returns the protocol address associated with the responding transport end point, the opt field presents any protocol-specific information associated with the connection, the udata field points to optional user data that may be returned by the destination transport user during connection establishment; and the sequence field has no meaning for this function.
The opt field implies no structure on the options that may be passed to the transport provider. The transport provider is free to specify the structure of any options passed to it. These options are specific to the underlying protocol of the transport provider. The user can choose not to negotiate protocol options by setting the len field of the opt field to 0. In this case, the provider may use default options.
The udata field enables the caller to pass user data to the destination transport user and receive user data from the destination user during connection establishment. However, the amount of user data must not exceed the limits supported by the transport provider as returned by the t_open or t_getinfo subroutine. If the len field of the udata field in the sndcall parameter is 0, no data is sent to the destination transport user.
On return, the addr , opt , and udata fields of the rcvcall parameter are updated to reflect values associated with the connection. Thus, the maxlen field of each parameter must be set before issuing this function to indicate the maximum size of the buffer for each. However, the rcvcall parameter may be null, in which case no information is given to the user on return from the t_connect subroutine.
By default, the t_connect subroutine executes in synchronous mode, and waits for the destination user's response before returning control to the local user. A successful return (that is, a return value of 0) indicates that the requested connection has been established. However, if the O_NDELAY flag is set (with the t_open subroutine or the fcntl command), the t_connect subroutine executes in asynchronous mode. In this case, the call does not wait for the remote user's response, but returns control immediately to the local user and returns -1 with the t_errno variable set to TNODATA to indicate that the connection has not yet been established. In this way, the function simply initiates the connection establishment procedure by sending a connect request to the destination transport user.
On successful completion, the t_connect subroutine returns a value of 0. Otherwise, it returns a value of -1, and the t_errno variable is set to indicate the error.
If unsuccessful, the t_errno variable is set to one of the following:
This subroutine is part of Base Operating System (BOS) Runtime.
The fcntl command.
The t_accept subroutine, t_getinfo subroutine, t_listen subroutine, t_open subroutine, t_optmgmt subroutine, t_rcvconnect subroutine.
List of Streams Programming References and STREAMS Overview in AIX Version 4.3 Communications Programming Concepts.