Add Book to My BookshelfPurchase This Book Online

Chapter 15 - Networking with TLI

UNIX Systems Programming for SVR4
David A. Curry
 Copyright © 1996 O'Reilly & Associates, Inc.

Chapter 15: Networking with TLI
Overview
Although the socket interface described in Chapter 13, Interprocess Communication and Chapter 14, Networking with Sockets, is both simple and popular, it is flawed in that it is not protocol-independent. Although sockets can be used with a wide variety of protocols, including UNIX IPC, TCP/IP, ISO/OSI, and XNS, a socket program written to use one of these protocols cannot be used with another protocol unless you change the source code. These changes, although usually minor, mean that it is not possible to have a single program that can simultaneously operate over any of the aforementioned protocols.
The Transport Layer Interface (TLI) attempts to solve this problem. The TLI is a library of functions that allow two programs to communicate using a transport provider. A transport provider is a device driver or other operating system interface that provides communications support. For example, the TCP/IP protocol support is a transport provider, while support for the Novell IPX protocol is another. The value of the TLI, though, is that, provided the programmer is careful to avoid taking any protocol-dependent actions, a single program written to the TLI can operate over any number of different transport providers without any source code changes. The program doesn't even need to be recompiled when a new transport provider is added.
The TLI library was introduced in System V Release 3. Unfortunately, although AT&T went to the trouble of developing this interface, they neglected to include a transport provider with SVR3, meaning that without purchasing a third-party product, the TLI had nothing to talk to. Until SVR4, which included a TCP/IP transport provider, was released, sockets continued to be the only viable interface for writing network programs. TLI fell by the wayside; it is next to impossible to find any programs, outside of the System V source code, that make use of the TLI.
Even though it is rarely used, the TLI is still worth learning about, especially if you will be supporting or maintaining System V systems. In this chapter, we examine the TLI functions, and discuss some of the differences between them and the socket interface. We will reimplement the examples from Chapter 14 here with TLI; you may find it useful to compare the two implementations.
Between SVR3 and SVR4, a number of improvements were made to the TLI library; most of these changes resulted in adding a network-independent method for handling host and service addresses. These changes were adopted by Sun and Silicon Graphics, and are included in Solaris 2.x and IRIX 5.x. Hewlett-Packard, on the other hand, for reasons of backward compatibility with their earlier releases, did not adopt these new functions. The TLI library in HP-UX 10.x is much more like the TLI library originally provided with SVR3 (and included in earlier versions of HP-UX). In this chapter, we describe the SVR4 TLI library and describe the differences between this and the library used on HP-UX 10.x.
All programs that make use of the TLI must be linked with the -lnsl library on Solaris 2.x and IRIX 5.x, and with the -lnsl_s library on HP-UX 10.x.

Previous SectionNext Section
Books24x7.com, Inc © 2000 –  Feedback