CS 464/564, Assignment 2
where r is an arbitrary string (the machine name) and p is a string representing a positive
number (the port number).
Once such a “remote” command has been sent, the shell awaits for, and prints everything
that the server cares to send back as a response. No terminating marker can be assumed for
the response received from the server.
The server response is printed in its entirety before the shell prompt is presented back to
the user, except when a remote command is prefixed by the character & followed by a blank
(the first two characters are not sent to the server). In such a case, the prompt is presented
immediately to the user, and all the pieces of the server response are printed to the terminal
as soon as they become available (the shell does not wait for the whole response, it prints
instead the received piece of the response as soon as this piece becomes available). An appropriate
message must be printed by the shell as soon as the server response has been received
in its entirety.
Many standard application protocols use for compatibility reasons \r\n as line terminator,
so your shell should accept responses with either \r\n of the normal Unix \n as line terminators.
• There are two new local commands (that must be issued prefixed by a ! to take effect):
Before such a command is issued, the shell opens a connection to the server each time
the user types in a remote command, and closes the connexion as soon as the server
response has been received. Once the command keepalive has been issued, the shell
opens the connexion to the server when a remote command is typed in, and then keeps
the connection open until a close command (see below) is issued (or upon termination).
In other words, all the subsequent remote commands will use the same connection
to the server.
Closes the connection to the server in case such a connection is open, and reverts the
behaviour to the initial one (the connexion to the server is closed after the completion
of each remote command).
What to submit Submit the sources for your shell plus appropriate documentation as described
on the course’s Web site. The default target of your makefile must produce an executable named
rsshell and residing in the root directory of your submission.
For testing your new remote facility you may want to use the simple server that listen on port
9001 on 10.18.0.22 (see the course’s Web site for more details on how to access the staging machines
including this one). This server does not implement much of an application protocol; it just
send back the received line twice, with a 2-second delay between the two copies. You may also
want to perform limited tests using the standard HTTP server running on osiris.ubishops.ca
and the SMTP server running on linux.ubishops.ca (note however that the latter is only accessible
locally, so your client must be running on linux.ubishops.ca to access this SMTP server). It
is your responsibility to research the application protocol for these two services. It is also your
responsibility not to DoS the servers.