/Users/lyon/j4p/src/classUtils/reflection/CompObjClient.java
|
1 //Ryan Metz
2
3 package classUtils.reflection;
4
5 import net.compute.*;
6
7 import net.compute.AutoClient;
8
9 import java.io.ObjectInputStream;
10 import java.io.ObjectOutputStream;
11 import java.io.Serializable;
12 import java.net.Socket;
13 import classUtils.dumper.ByteCodeContainer;
14
15 public class CompObjClient implements
16
17 Runnable {
18 public static void setCo(Class co) {
19 CompObjClient.co = co;
20 }
21
22 private static Class co;
23 //public String autoServerName = "192.168.1.96";
24
25
26 //use "localhost" for my machine
27 public String autoServerName = "localhost";
28
29
30 public void run() {
31 try {
32 Socket s
33 = new Socket(autoServerName,
34 AutoServer.PORT);
35 ObjectInputStream
36 ois =
37 new ObjectInputStream(
38 s.getInputStream());
39 ObjectOutputStream
40 oos =
41 new ObjectOutputStream(
42 s.getOutputStream());
43 ByteCodeContainer rcl = new
44 ByteCodeContainer(co);
45 oos.writeObject(rcl);
46 oos.writeObject(co);
47 Object o = ois.readObject();
48 System.out.println(o);
49 ois.close();
50 oos.close();
51 } catch (Exception e) {
52 System.out.println(
53 "You must run the autoserverFirst, then the compobjclient....");
54 }
55 }
56
57 public static void main(String args[]) {
58 // uncomment for a local invocation
59 // AutoServer.main(args);
60 AutoClient ac = new AutoClient();
61 ac.run();
62 }
63 }
64
65