DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Developing applications using XTI or TLI

How clients and servers communicate

To contact a particular server, a client first creates a transport endpoint by calling t_open. In this call, the client specifies the transport provider it will use. Each transport provider available is designated by the pathname of a device in the UNIX filesystem. For example, the TCP transport is identified by the pathname /dev/inet/tcp.

The client then calls t_alloc to allocate a data structure to contain address information. The client places into the data structure the address information needed by the transport provider to locate the desired server. The client then calls t_connect to contact the server, passing the data structure to the function as an argument. The next section, ``Transport addresses'', has more information about the address information required.

Before clients can successfully connect to a server, however, the server must be waiting for an incoming connection request. The server first calls t_alloc to allocate a data structure to contain address information. It then calls t_listen (with the allocated data structure as one of its arguments), and waits for a client to contact it. When a connection request arrives, t_listen returns with the client address information in the allocated data structure. The server can either reject the request by calling t_snddis (send disconnect) or accept the request by calling t_accept.

When a client is finished communicating over the network, it calls t_snddis to abort the connection, t_unbind to disassociate address information from the transport endpoint, then t_close to delete the transport endpoint. If the client is simply finished with the one server and wants to connect to another, it calls t_snddis to abort the connection, followed by t_connect to send a connection request to the new server.


Next topic: Transport addresses
Previous topic: Client-Server computing

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003