Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

The Talk Client and Server

This survey of different chat programs begins by looking at talk. This is arguably the grandfather of all network-aware chat programs. It is certainly the program that served as an inspiration for IRC—much the same way as both IRC and talk have provided the fundamental ideas used in newer chat and instant messaging protocols, such as ICQ and AIM.

talk is a very simple, basic chat program. All the client does is establish a link between the terminals of two computer users. The users can either reside on the same computer or on different, networked computers. Everything that one user types into his terminal will instantly be shown on the other user's terminal and vice versa.

There are several versions of the talk command and the underlying protocols. Unfortunately, not all of them are compatible with each other. The initial version of the talk protocol used machine-dependent byte ordering. Therefore, you could only use talk to communicate with people who used computers with the same processor architecture as your computer's processor. In order to overcome this problem, ntalk was created. This new talk client always uses network byte order. The first version of ntalk was not compatible with the old talk command. However, the version that is included with this release of Linux tries to fix talk packets with the wrong byte order, such as those that originate from legacy talk clients. To be able to differentiate between the talk and ntalk protocols, they are assigned to different TCP ports. If you look in your /etc/services, you will see that port 517 is used for talk and 518 for ntalk.

Setting Up and Configuring Talk

Naturally you need to have the talk client package installed to be able to use the talk command. Furthermore, to be able to receive talk requests you will also need to have the talkd daemon installed. This daemon is launched by xinetd whenever a talk request arrives at one of the TCP ports that have been defined for talk. If you have installed your computer as a workstation, xinetd will not have been installed automatically. In that case, you will have to install xinetd yourself.

The following example shows how you can determine whether the needed packages are installed on your computer (the version numbers in the query output may vary from system to system):

   $ rpm -q xinetd talk talk-server

If any of the packages are not installed, the output from rpm will inform you which packages are missing. You will need to obtain the missing RPM packages and install them. See the summary at the end of this chapter for places where you can obtain those RPMs.

Once you have obtained the RPM packages, it is time to install them on your computer. In order to do this you have to be logged in as the root user. You must be sure to install the RPMs in the correct order, because they depend and build upon functionality available in the other packages. You should first install the talk package, then the xinetd package, and finally the talk-server package. Of course, the last two packages are only needed if you want to be able to receive talk invitations. As an example, to install the talk client package you would issue the following command (once again, the version number may differ):

rpm -Uvh talk-0.17-7.i386.rpm.

If you have chosen to include a fully functional talk service, you should proceed to install the talk-server package as well as the xinetd RPM. When you have installed xinetd, be sure to start the xinetd daemon. You do this by typing

/etc/rc.d/init.d/xinetd start

Manually starting the service is only necessary directly after the installation. The installation process will have added an entry in your run-level files that will automatically start the daemon every time the system is restarted in the future.

After you have installed the necessary RPMs, try to run the talk command like this:

talk <your own user name>

Something akin to the following message should appear on your terminal:

[Waiting for your party to respond]
Message from at 21:31
talk: connection requested by
Talk: respond with: talk

If either talkd or xinetd are not installed and enabled, you will receive the following message:

[No connection yet]
[ Error on read from talk daemon : Connection refused ]

Connecting with Talk

Basically, there are two ways to use talk. Either you try to initiate a chat with another user or someone tries to chat with you. You can either talk to a user that is logged on locally or to a user that is reachable via the network.

To connect to a user on the local machine you will only need to know his login name. You can check to see who is logged in for the moment with the who command. For example:

$ who
patrikj  tty1     Jul  6 21:51
wsb      pts/1    Jul 18 06:56

Assume that you would like to try to talk to another user who has wsb as his user id. You would need to send an invitation to him by issuing talk wsb. The other user will then get a message on his terminal informing him that you would like to chat.

When you want to talk to a user on another computer you need to know both his login id as well as the name of the computer that he logged onto. For example, assuming that you want to talk to the user from the previous example, who is now logged onto a computer named, you would type talk

Assume that the wsb user from the previous example tries to contact you from his system, You would receive something like this on your terminal:

Message from
talk: connection requested by
talk: respond with: talk

As the message indicates, you would initiate a connection to wsb by typing talk After the connection has been established you can chat with him via talk's rudimentary user interface.

When you try to establish a talk link, you can also define to which terminal, or tty as they are often referred to in UNIX lingo, your request should be directed. To do this you simply add the name of the tty after the username. This can be useful if the user to whom you wish to chat is logged in with several terminal sessions.

Chatting via Talk

After the talk session has been established your terminal screen will split into two parts. The upper part is where you will type text. Whatever you type will show up immediately on the recipient's side. The lower part of the terminal window will show whatever the person to whom you are chatting is writing.

Typing certain control sequences serve as commands to the talk client. Table 7.1 shows the command sequences that are available while chatting. The scroll commands will only affect your side of the talk session.

The Meta key is usually assigned to your Alt key. You may also use the Escape key as a substitute for the Meta key. To do this, press the Escape key and then press the key that you want to combine it with. Please note that this will not auto repeat—so you will need to perform the escape combination repeatedly to scroll more than one line at a time.

Table 7.1. Control Commands Used in Talk Sessions

Command Description
Ctrl+c Ends the talk session.
Ctrl+l Redraws the screen.
Ctrl+n Scrolls the upper text buffer down.
Ctrl+p Scrolls the upper text buffer up.
Ctrl+u Deletes the current row.
Ctrl+w Deletes the current row.
Meta+n Scrolls the lower text buffer down.
Meta+p Scrolls the lower text buffer up.

Controlling Access to Your Terminal

Sometimes you might not want people to be able to interrupt you by requesting to talk to you. To avoid this you can use the mesg command to turn off external access to your terminal. There are two possible parameters for mesg: y or n. A y indicates that access is allowed, whereas an n is used to disallow access. Running mesg without any parameter will show the current state of your terminal. The default behavior of a new terminal is to have external access turned on.

If a user tries to talk to you while you have turned off access to your terminal, he will receive a similar error message:

[Your party is refusing messages]

Turning off access to your terminal will affect all commands that try to write to your terminal. Examples of such commands are wall and write.

Talking with Multiple Users with ytalk

The regular talk client can only be used for chats involving two persons. To alleviate this restriction, a new talk client called ytalk has been created. Using this you can chat with multiple users at the same time. The functionality of ytalk is more or less the same as talk.

The ytalk command is not very common, even though it is becoming increasingly popular. Thankfully, it is compatible with the ordinary talk client. So there is nothing to stop you from using it to chat with other users who have access only to the talk command.

One nice feature of ytalk is that if you run it under the X Window System you will get a GUI version of the command; this behavior can be inhibited by specifying the -x switch. The GUI interface is pretty basic and consists of two windows. One window will be your input window, and anything you type there will be sent to all other users' talk clients. There will be a separate window for each user you are talking to.

If you run the client without the X Window interface, the screen will look more or less as it does in an ordinary talk session. The screen will be split once for each user who is taking part in the conversation and the output from them will be shown there.

Another feature of ytalk is that you can redirect the output of other commands to it. This can be very useful if you need to send a file listing or something similar to other users.

Because ytalk is not that common, I will not go into it much further. If you want more information about it please refer to its man page.

+ Share This