Tutorial week 3
- Write a TCP DayTime server. Try to get your client to work with
someone-else's server and vice versa
- Modify the concurrent Echo server to log all messages sent
to it, recording the hostname and message. Hint: use a
PrintStream
object (which uses a File
object) which is shared by all threads,
and use this object to synchronise writes
- The time protocol (IETF RFC 868,
http://www.faqs.org/rfcs/rfc868.html) returns the elapsed time
as a 32-bit integer, which is the number of seconds since
1 January, 1900.
The specification gives the time as a signed integer. No implementation
has ever followed this specification as they all return a 32-bit unsigned
integer.
-
If a signed integer was returned, what is the last date that
could be given?
-
Write a client to access this service.
This service should be running on port 37 of jan.newmarch.name
- Discuss how to serialize the following:
- An array of positive and negative integers
- An array of positive integers
- A variable length array of strings (with no embedded newlines)
can be serialized by
-
Printing the number of strings, and then printing each
string on a newline
-
Printing each string on a newline, and then terminating
the list with a blank line
Write Java code to write an array of strings from a
server to a client, using both representations.
What modifications can you make to these representations
to handle the case where the strings may have embedded newline
characters?
Jan Newmarch (http://jan.newmarch.name)
jan@newmarch.name
Last modified: Mon Aug 8 10:28:44 EST 2005
Copyright ©Jan Newmarch