/Users/lyon/j4p/src/net/date/DateServer.java

1    package net.date; 
2     
3    import java.io.IOException; 
4    import java.io.ObjectOutputStream; 
5    import java.net.Socket; 
6    import java.util.Date; 
7     
8    public class DateServer extends Thread { 
9      ObjectOutputStream oos; 
10    
11     public DateServer(Socket s) 
12         throws IOException { 
13       oos = 
14           new ObjectOutputStream( 
15               s.getOutputStream()); 
16         start(); 
17     } 
18    
19     public void run() { 
20       try { 
21         oos.writeObject("This is a test of the date system:"+new Date()); 
22         oos.close(); 
23       } catch (IOException e) { 
24         e.printStackTrace(); 
25       } 
26     } 
27   } 
28