Remote write protocol

version 1.00

Remote write protocol should allow non-local users to write on your terminal. It should be even used by local users - as there's much better control over it. There should be no more programs like write, in.talkd, comsat, etc. running setgid tty. As user have oportunity to make all writes go through his program, it's also chance that sometime in future writing on one's tty will no longer trash his display.

Protocol specification

Remote write protocol uses TCP port 654 (rwrite). After connection, remote side has to pass 4 lines (separated with LF = \x0a):

Name of target user
Name of user who requests write
Subject of write

[blank line]
actual contents of message
...which may be multiline...

Name of target user

Name of target user is just name of target user, i.e. "joe". If there's some finer identification of where to write to (name of tty on unix system) and deamon decides to support it, name should have "[terminal_identification%]actual_username" form (terminal_identification must be optional).

Name of user who requests write

This is name of user who asked to write on target user's console. It must be identical with user's login name, as remote side may decide to validate it using ident service. If some kind of network daemon (on local machine) decides to write on someone's console, it should be name of system administrator ("root" on unix systems), so authenticity may be validated by ident service, too.

Subject of write

This line should contain machine-decodable reason why other side wants to print something. In case human just wants to print something (like functionality of write program), subject should be "write". In case some daemon wants to write on user's screen, subject should start with name of daemon. If daemon wants to pass some machine-decodable parameters, name should be followed by TAB character (code \0x09) and list of parameters separated by TABs.


Imagine that user joe@falcor wants to talk with pavel@atrey. After talk daemons connect with each other, talk daemon on atrey should send following lines to write daemon:


*** Talk connection requested by joe@falcor.

Standartized subjects

It would be nice to have standartized subjects (to make machine decoding easier). Here are cases which I can 'look-ahead' and assign them before they are needed. If some server wants to pass some additional information, it may, simply adding TAB and info at the end of the list. But please notify me, so we can assure that all extensions will be done in same way.

In following table, ";" is written where (TAB) is meant - as it is a bit shorter

Name of service Assigned subject Comment
writewriteTo be used when user talks to writed directly in order to put some message on target's screen
talktalk;fromuser@domainTo be used by standart talk protocol, when talk with target user is requested
new mailnewmail;fromuser@domain;subjectThis is for tools that inform user about new mail
forumforum;fromuser@domain;subjectForum is kind of extended talk, it supports 'subject' to be passed with talk request.
shutdownshutdown;time;new_state;reasonThis should be used as 'system is going down' announce. Time should be decimal number (in seconds), new_state should be one of halt,singleuser,reboot,crash, reason is not mandatory, it should be explation given by human
broadcastwallwall is service to write all users on one system, commonly done by command wall
panicpanic;severity_levelthis will probably be never used (as in time panic is called there's no time to talk to system daemons), but it could be. Severity_level is one of emerg,alert,crit,err,warning,notice,info,debug, for meanings look at man syslog

If you implement some daemon which needs to print to user's terminal and is not covered here, or if you have some additional arguments to pass, please let me know. Well, in case you start to use this protocol in some of your programs, please let me know. I'm just curious...

Response codes

Writed sends single line of response code of form X00: followed by explanation in english. X is character, either + (everything OK) or - (some error), or maybe something else, in such case whole line should be ignored. Here is current list of response codes, more may be added later.

Note, that no program should depend on english texts, following english texts are just examples. There are some info in them, but they are intended for humans only.

+01: Accepted, calling user's .ttywrite
+02: Accepted, writing on ttyp12
-01: No such user
-02: User is not logged in
-03: User has messages disabled

Pavel Machek