B
Brian
Hi
I'm trying to write a little program that can send an object between a
client and a server - and back. It won't work and I get theese
exceptions:
Server:
java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: MyObject
Client:
java.io.NotSerializableException: MyObject
I need a little hint
/Brian
The server:
****************************
ServerSocket ss = new ServerSocket(port);
Socket con = ss.accept();
ObjectInputStream in = new ObjectInputStream(con.getInputStream());
MyObject my = (MyObject) in.readObject();
ObjectOutputStream out = new
ObjectOutputStream(con.getOutputStream());
out.writeObject(my);
out.flush();
con.close();
****************************
The client:
**************************
Socket con = new Socket("localhost", port);
ObjectOutputStream out = new
ObjectOutputStream(con.getOutputStream());
out.writeObject(new MyObject());
out.flush();
ObjectInputStream in = new ObjectInputStream(con.getInputStream());
MyObject my = (MyObject) in.readObject();
System.out.println(my.toString());
con.close();
****************************
I'm trying to write a little program that can send an object between a
client and a server - and back. It won't work and I get theese
exceptions:
Server:
java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: MyObject
Client:
java.io.NotSerializableException: MyObject
I need a little hint
/Brian
The server:
****************************
ServerSocket ss = new ServerSocket(port);
Socket con = ss.accept();
ObjectInputStream in = new ObjectInputStream(con.getInputStream());
MyObject my = (MyObject) in.readObject();
ObjectOutputStream out = new
ObjectOutputStream(con.getOutputStream());
out.writeObject(my);
out.flush();
con.close();
****************************
The client:
**************************
Socket con = new Socket("localhost", port);
ObjectOutputStream out = new
ObjectOutputStream(con.getOutputStream());
out.writeObject(new MyObject());
out.flush();
ObjectInputStream in = new ObjectInputStream(con.getInputStream());
MyObject my = (MyObject) in.readObject();
System.out.println(my.toString());
con.close();
****************************