Peeyush Maurya's Technical Guide for Sending Messages to Users

Sending messages to users/terminal in Windows and Linux

WINDOWS

Netsend is DOS command which can send message accross

NET SEND {name | * | /DOMAIN[:name] | /USERS} message

Sends messages to other users, computers, or messaging names on the network. The Messenger service must be running to receive messages.

You can send a message only to an name that is active on the network. If the message is sent to a username, that user must be logged on and running the Messenger service to receive the message.

name Is the username, computername, or messaging name to send the message to. If the name is a computername that contains blank characters, enclose the alias in quotation marks (" ").
* Sends the message to all the names in your group.
/DOMAIN[:name] Sends the message to all the names in the workstation domain. If name is specified, the message is sent to all the names in the specified domain or workgroup.
/USERS Sends the message to all users connected to the server.
message Is text to be sent as a message.

c:\net send 192.168.0.2 "hi how r u"
Note : u can use "within quotes" to send long message.

C:\net send othercomputer "tes from my computer"
NOTE : You can use machine/host name instead of IP Address

How to know the host name if u have IP address?
ping -a 192.168.0.2

LINUX

You have to check if your 'mesg' is enabled or not..

Lets have a look at 'mesg' command in linux.

NAME : mesg - control write access to your terminal
SYNOPSIS : mesg [y|n]
DESCRIPTION : Mesg controls the access to your terminal by others. Its typically used to allow or disallow other users to write to your terminal (See write).
OPTIONS : y Allow write access to your terminal. n Disallow write access to your terminal.

If no option is given, mesg prints out the current access state of your terminal.

Mesg assumes that its standard input is connected to your terminal. That also means that if you are logged in multiple times, you can get/set the mesg status of other sessions by using redirection. For example "mesg n < /dev/pts/46".

So, first check is mesg is y in yours and for recipent. Then

NAME : write - send a message to another user
SYNOPSIS : write user [ttyname]
DESCRIPTION : Write allows you to communicate with other users, by copying lines from your terminal to theirs.

When you run the write command, the user you are writing to gets a message of the form:

Message from yourname@yourhost on yourtty at hh:mm ...

Any further lines you enter will be copied to the specified user's terminal. If the other user wants to reply, they must run write as well.

When you are done, type an end-of-file or interrupt character. The other user will see the message EOF indicating that the conversation is over.

You can prevent people (other than the super-user) from writing to you with the mesg command. Some commands, for example nroff and pr, may disallow writing automatically, so that your output isnt overwritten.

If the user you want to write to is logged in on more than one terminal, you can specify which terminal to write to by specifying the terminal name as the second operand to the write command. Alternatively, you can let write select one of the terminals - it will pick the one with the shortest idle time. This is so that if the user is logged in at work and also dialed up from home, the message will go to the right place.The traditional protocol for writing to someone is that the string, either at the end of a line or on a line by itself, means that its the other person's turn to talk. The string means that the person believes the conversation to be over.

SEE ALSO :mesg, talk, who
HISTORY : A write command appeared in Version 6 AT&T UNIX.

Ok, so u can send messages to users and now you want some more... wanna chat...

NAME : talk - talk to another user
SYNOPSIS : talk person [ttyname]
DESCRIPTION : Talk is a visual communication program which copies lines from your terminal to that of another user.
Options available: person If you wish to talk to someone on your own machine, then person is just the person's login name. If you wish to talk to a user on another host, then person is of the form 'user@host'.

ttyname If you wish to talk to a user who is logged in more than once, the ttyname argument may be used to indicate the appropriate
terminal name, where ttyname is of the form 'ttyXX' or 'pts/X'.

When first called, talk contacts the talk daemon on the other user's machine, which sends the message Message from TalkDaemon@his_machine... talk: connection requested by your_name@your_machine. talk: respond with: talk your_name@your_machine to that user. At this point, he then replies by typing

talk your_name@your_machine

It doesn't matter from which machine the recipient replies, as long as his login name is the same. Once communication is established, the two parties may type simultaneously; their output will appear in separate windows. Typing control-L (^L) will cause the screen to be reprinted. The erase, kill line, and word erase characters (normally ^H, ^U, and ^W respectively) will behave normally. To exit, just type the interrupt character (normally ^C); talk then moves the cursor to the bottom of the screen and restores the terminal to its previous state.

As of netkit-ntalk 0.15 talk supports scrollback; use esc-p and esc-n to scroll your window, and ctrl-p and ctrl-n to scroll the other window. These keys are now opposite from the way they were in 0.16; while this will probably be confusing at first, the rationale is that the key combinations with escape are harder to type and should therefore be used to scroll one’s own screen, since one needs to do that much less often.

If you do not want to receive talk requests, you may block them using the mesg command. By default, talk requests are normally not blocked. Certain commands, in particular nroff(1), pine(1), and pr(1), may block messages temporarily in order to prevent messy output.

FILES : /etc/hosts to find the recipient's machine /var/run/utmp to find the recipient's tty
SEE ALSO : mail, mesg, who, write, talkd
BUGS : The protocol used to communicate with the talk daemon is braindead.

Also, the version of talk(1) released with 4.2BSD uses a different and even more braindead protocol that is completely incompatible. Some vendor Unixes (particularly those from Sun) have been found to use this old protocol.

Old versions of talk may have trouble running on machines with more than one IP address, such as machines with dynamic SLIP or PPP connections. This problem is fixed as of netkit-ntalk 0.11, but may affect people you are trying to communicate with.

HISTORY :The talk command appeared in 4.2BSD.

ok , now since you can chat and send message to a user, now lets try sending message to all

NAME : wall -- send a message to everybody's terminal.
SYNOPSIS : wall [ message ]
DESCRIPTION : Wall sends a message to everybody logged in with their mesg(1) permission set to yes. The message can be given as an argument to wall, or it can be sent to wallGÇÖs standard input. When using the standard input from a terminal, the message should be terminated with the EOF key (usually Control-D).

The length of the message is limited to 20 lines.

NOTES : There is an undocumented (well not anymore..) option, "-n", that supresses the banner printed by wall . This is for usage by rwalld. Wall will not allow you to use that flag if wall is installed set-group-id and the user executing wall is not root.

For every invocation of wall a notification will be written to syslog, with facility LOG_USER and level LOG_INFO.

ENVIRONMENT : Wall ignores the TZ variable - the time printed in the banner is based on the systems local time.
SEE ALSO : mesg, rpc.rwalld.

Back to main page

Write to me if you have any questions/doubts or needs any technical help (no Charges)
mail me at peeyush_maurya@yahoo.com
Please Sign Guestbook to boost my moral :: View Guestbook
..