publicclass DateClient { publicstaticvoid main(String argv[]){ ObjectOutputStream oos =null; ObjectInputStream ois =null; Socket socket =null; Date date =null; try{ // open a socket connection
socket =newSocket("yourMachineNameORipAddress", 3000); // open I/O streams for objects
oos =newObjectOutputStream(socket.getOutputStream());
ois =newObjectInputStream(socket.getInputStream()); // read an object from the server
date =(Date) ois.readObject(); System.out.print("The date is: "+ date);
oos.close();
ois.close(); }catch(Exception e){ System.out.println(e.getMessage()); } } }