User Tools

Site Tools


haas:fall2019:unix:cs:cs4


Corning Community College


UNIX/Linux Fundamentals



Case Study 0x4: UNIX Messaging Tools

~~TOC~~

Objective

Exploring some of the UNIX multiuser facilities.

Background

As learned in Lab #0, the mesg utility controls whether or not you can receive messages and message requests from other users on the system.

Now we will further explore this facet of the UNIX system. To begin with, all parties involved must be able to accept messages. A simple check with the who utility will reveal all those users that are willing to accept messages (+), and those that have messaging disabled (-).

The write utility allows for one-way communication between two users. To write a quick message to another user, you would do the following:

lab46:~$ write username

You can then enter your message. When you hit return, the entire line will be displayed on the receiving user's terminal. (Your text is therefore said to be “buffered by line.”)

To end your write session, simply hit enter to get to a blank line, and then issue a CTRL-D. This will tell write your message is completed.

For the receiving user, a notification will appear along with the the message*:

lab46:~$ 
Message from yourusername@lab46 on pts/3 at 11:39 ... 
This is a test message. Hi!
EOF

The EOF indicates the sending user has completed their message, and you will not be receiving any more lines of the message for that particular write session.

The entire write message is echoed to the terminal screen. None of it is interpreted by the shell (or any other program)- it is merely text displayed to your terminal device. If you hit enter you will see your prompt. If you are in some program and the message has messed up your display, refresh the screen with a CTRL-L.

The talk utility allows for two-way interactive communication between two users (that is, “buffered by character”). A talk session is initiated as follows:

lab46:~$ talk receiverusername

The recipient of the talk request sees the following echoed to their terminal:

lab46:~$ 
Message from Talk_Daemon@lab46 at 12:00 ... 
talk: connection requested by senderusername@lab46.corning-cc.edu. 
talk: respond with: talk senderusername@lab46.corning-cc.edu

And, just like the messages generated by write, you can hit enter or CTRL-L to get your prompt back or terminal refreshed. Then if the recipient enters: talk yourusername the session will start. Both users will see each other's text as they type it in. Each user will be on the top of the screen, with the other party on the bottom of the screen.

To end a talk session, issue a CTRL-C.

Finally, the ytalk utility takes talk a couple steps further and allows not only for multi-user conferences, but has enhanced terminal features. The manual page on ytalk will give more detail into the improved features ytalk has to offer.

ytalk is invoked exactly the same way talk is, and the notification message is even the same. ytalk and talk can be used interchangeably. However, to attain the full benefits of ytalk, ALL parties involved must use ytalk.

Exercise

1. With permission from another user (preferably someone in this class) on the system, experiment with the write(1) utility:
a.Practice sending a few messages back and forth to get familiar with it.
b.Refreshing the screen with a CTRL-L sequence to get rid of any write messages on your terminal or in applications you are running when a message is sent to you.
c.What user(s) did you communicate with?

Since we may not want to be available for messaging at all times, let's take a look at some ways of controlling access to that facility:

2. Experiment with the mesg(1) utility while using write(1):
a.What message does write(1) give you if the recipient has messages turned off?
b.What message does write(1) give you if you have messages turned off while trying to use write(1)?

And finally, we get to play with some full-fledged methods of talking on a UNIX system:

3. Let's experiment with the ytalk(1) utility:
a.What happens if you try to talk to a user with messages disabled?
b.What user(s) did you communicate with?
4. Using the multi-user features of the ytalk(1) utility:
a.Set up a conference with at least 2 other users.
b.Have a user leave then rejoin the conference.
c.What users did you communicate with?
d.ytalk has some neat features. Play around with them (hit the ESC key)
e.How do you open a shell within ytalk?

So now hopefully you have a better idea of some methods of communicating on a UNIX system.

Conclusions

This assignment has activities which you should tend to- document/summarize knowledge learned on your Opus.

As always, the class mailing list and class IRC channel are available for assistance, but not answers.

haas/fall2019/unix/cs/cs4.txt · Last modified: 2013/09/24 09:48 by 127.0.0.1