This code works fine.
But in line 16 you can see that the content of the stream has to be generated again and again for every Client. -> is there a way to send it to all streams at once?
You'll have to overwrite all OutputStream methods, including flush and close, and use a loop to call that same method on all contained output streams. But that basic code you have there should work.
Ok, I've tested it and it nearly works.
The only problem is that the ObjectOutputStream sends the typeName of java.util.Date only once, so when there's a client which connnects later doesn't know what to do with the incoming data.
How do I force the ObjectOutputStream to print the classDescriptors.
here's the stdout("..." is for the data sections):
Initializing
Configuring streams
Starting server
Server is running
Sending time
...java.util.Date...
Sending time
......
Sending time
......