/Users/lyon/j4p/src/net/date/DateClient.java
|
1 package net.date;
2
3 import java.io.ObjectInputStream;
4 import java.net.Socket;
5
6 public class DateClient implements Runnable {
7 public static void main(String args[]) {
8 DateClient dc = new DateClient();
9 dc.run();
10 }
11
12 public void run() {
13 try {
14 Socket s
15 = new Socket(
16 "172.16.11.107", MainServer.PORT);
17 ObjectInputStream
18 ois = new ObjectInputStream(
19 s.getInputStream());
20 Object o = ois.readObject();
21 if (o instanceof String) {
22 System.out.println("we have a string!");
23 String string = (String)o;
24 System.out.println(string);
25 }
26 System.out.println( o);
27 ois.close();
28 } catch (Exception e) {
29 e.printStackTrace();
30 }
31 }
32 }