The Term Protocol

Need to run multiple tasks but have only a standard dial-up connection to the host? Term may be the answer you have been looking for.

txconn is designed to ease the redirection of X applications from one host to another. If a user on computer2 wants to display an X application on your screen, you use txconn. Like using tredir, any incoming connections must use your remost host's name or IP address to connect to you.

Because X is outwardly different than normal TCP/IP clients, it needs special handling for redirection. By itself, txconn uses no command line arguments:

remotehost% txconn
Xconn bound to screen 9

This means that your home X display can be accessed from the network as remotehost:9, meaning root window 9 on the remotehost. If a user on computer2 wants to send his xclock to your local display, he would type:

computer2% setenv DISPLAY
remotehost:9 computer2% xclock &

After a few moments, the xclock he executed will appear on your display.

If you want to display an X application running on your computer to computer2's display, you must use tredir. This is a bit confusing.

linuxbox% tredir 6004 computer2:6000
Redirecting 6004 to computer2:6000
linuxhox% export DISPLAY=localhost:4
linuxbox% xclock &

This may look a bit odd, but what you are doing is redirecting your display :4 (unused by you) to computer2's default display of :0. Ports 6000-6100 represent displays :0 to :100. By redirecting your own display :4 to his :0, any X application on your local machine which uses display :4 will appear on computer2's screen. It's a bit convoluted, but it works effectively.

Other Term Clients

Because of the nature of term, applications that work with standard TCP/IP will not work without the use of tredir, and even then, they may not always work. For example, it would be impossible to use tredir for an application like NCSA Mosaic because it makes so many different connections to different hosts and services. Other applications, though they use a single network connection, don't work because they use a secondary data port, such as ftp or IRC's DCC protocol. Applications such as this require modification of the actual source code to utilize the term socket. Most popular applications such as Mosaic, lynx, ftp, ncftp and irc have already been modified for use with the term protocol.

If you compile these applications yourself, they must be linked with the term library, libtermnet.a (This library has replaced the old client.a library.) This library contains the needed instructions and symbols for using the term socket.

New developments in term have made it extremely easy for users to modify existing TCP/IP applications for use with term, without the massive source code modifications that were once required. By using drop-in replacements for common socket/networking functions such as connect(), gethostbyname(), and send(),you need only modify the Makenle of an application to make it term-compliant. This drop-in replacement is the libtermnet.a library, and a header file which translates standard networking calls into term-compliant calls. One interesting note is that a termnet-linked binary also works with normal TCP/IP, so if you ever change to SLIP or PPP in the future, your term-compliant binaries will still work!

Only two elements are needed in the Makefile to make a term-compliant binary. In the location where the INCLUDES are defined, you add:

-include /usr/src/term200/termnet.h

adapting the path for your term source path, of course.

And in the LIBS or LDFLAGS section, you add:

-L/usr/local/lib -ltermnet

If you have libtermnet.a or the* shared library installed in a common library path, -L/directory/path isn't needed.

Hopefully, after adding these definitions, you end up with,` fully term-compliant binary. There are still a few shortfalls, of course. Many applications use non-standard socket calls, and termnet cannot fully control things like that. Also, the newly integrated (as I write) udp support in term is still very rough.

Applications such as Chimera, lynx, xarchie, rsh/rlogin and fsp are a few examples of successful tennnett~ng, and more are sure to follow.

With the implementation of termnet, the days of manual source-level hacking on most applications is over, and more and more applications that were once too hard to hand-patch term support into will be available to term users.

The Future of Term

After term116, the term development was passed on to Bill Riemers ( Major additions to term have been introduced, such as udp support, which is getting better and better, and shared libtermnet, which allows easy upgrading of term versions without recompiling term-compliant binaries every single time. The udp support has enabled such applications as ytalk, xarchie and fsp to Work through term.

There are still a lot of things to complete and improve with term, but it's a very successful and very useful tool for people who don't have the resources to run full-blown SLIP or PPP. It is very good, and can only get better.

Liem Bahneman is a student Unix consultant at the University of Washington and is the administrator of the Linux Organization WWW home page. Liem has heen using Linux and term for almost two years and in his free time develops X11 applications in C and tcl/tk.