CONE
home
general
info
course
contents
class
schedule
instructor
students
news
exams
theses
archive
faq
links
contacts
CONE
theory
CONE
lab |
CONE Lab
Exercise with
sockets
Write a client-server
application which uses a socket as communication means:
- Server
features
- Waits
on a well-known port that can be defined through the command line
- Handles
the authorization phase with the client (user+password)
- Accepts
the commands
list command from the client and returns the list of commands
the client can execute through the server
- Accepts
the execute
commmand
<parameters> command
-
Verifies whether command belongs to the list of the allowed
commands and, in this case, executes locally the command and
returns the result to the client
-
In the negative case, returns an error message
-
Goes back waiting for a new command from the client
-
Understands the quit
command and closes the connection
- Client
features
- Connects
to a server specifying name and port through the command line
- Handles
the authorization phase with the server (user+password)
- Allows
to send the the commands
list command to
the server and shows the list of commands the client can execute
through the server
- Allows
to send the execute
commmand
<parameters> command
to the
server
- Shows
the result of the remote execution to the user
-
Allows the user to execute a new command
-
Handles the he
quit
command that closes the connection
Socket
theory
Examples
of client and a server
(written in C for a Linux environment) communicating through sockets
|