CS 580 Client-Server Programming
Spring Semester, 2005
Assignment 3
© 2005, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 2/17/05
Assignment 3
Time-Date Server Protocol
A client connects to the server and sends one two possible messages:
date<cr>
time<cr>
Where <cr> is a carriage return, that is the ascii character with value 13.
When the server receives a connection, it will read the request and then close the connection. The server response is shown in the table below.
Client Message |
Server Response |
---|---|
date<cr> |
Current date<lfcr> close connection |
time<cr> |
Current time<lfcr> close connection |
all other |
close connection |
<lfcr> indicates a line feed (ascii 10) followed by carriage return (ascii 13).
All characters are sent are ascii characters and sent as a single byte.
Problems
1. Write a server for the time-date protocol. The server does not have to use threads
2. Write a client for the time-date protocol. The client does not have to use threads or a GUI.
Questions
1. Connect to your server via telnet and send the date message. What happens?
2. Connect to your server via telnet, but don’t send a message. Using another telnet session or your time-date server client (with the first still active) connect to the server and sent either a date or time message. What happens? Send a date or time message on the first telnet session. Now what happens?
3. Connect to your server via telnet, but don’t send a message. Using another telnet session (with the first still active) connect to the server and sent either a date or time message. Now terminate (or kill) the first telnet session without sending any data to the sever. What happens to the second session?
4. Modify your server to only return a <cr> after the time or date. What happens when you connect to the server and request a time or date using telnet?
5. Modify your server to only the time or date without returning either a <cr> or <lf>. What happens when you connect to the server and request a time or date using telnet?