/Users/lyon/j4p/src/net/compute/AutoClient.java
|
1 package net.compute;
2
3 import java.io.ObjectInputStream;
4 import java.io.ObjectOutputStream;
5 import java.io.Serializable;
6 import java.net.Socket;
7 import classUtils.dumper.ByteCodeContainer;
8
9 public class AutoClient implements
10 Runnable {
11 //public String autoServerName = "192.168.1.96";
12
13 public String autoServerName = "localhost";
14 public void run() {
15 try {
16 Socket s
17 = new Socket(autoServerName,
18 AutoServerLyon.PORT);
19 ObjectInputStream
20 ois =
21 new ObjectInputStream(
22 s.getInputStream());
23 ObjectOutputStream
24 oos =
25 new ObjectOutputStream(
26 s.getOutputStream());
27 BigComputation co = new BigComputation();
28 ByteCodeContainer rcl = new
29 ByteCodeContainer(co.getClass());
30 oos.writeObject(rcl);
31 oos.writeObject(co);
32 Object o = ois.readObject();
33 System.out.println(o);
34 ois.close();
35 oos.close();
36 } catch (Exception e) {
37 e.printStackTrace();
38 }
39 }
40
41 public static void main(String args[]) {
42 // uncomment for a local invocation
43 // AutoServer.main(args);
44 AutoClient ac = new AutoClient();
45 ac.run();
46 }
47 }
48
49 class BigComputation implements ComputableObject {
50 String s = "good bye world";
51
52 public Serializable compute() {
53 return s;
54 }
55 public void sillyness() {
56
57 }
58 }