posted 22 years ago
Hi All,
I actually posted this a few days ago in the Sockets forum, but it seems there are not many folks visiting that forum. Hopefully someone here has seen this problem before. Thanks!
I have an interesting problem (at least to me). I am experimenting with ObjectInputStream, ObjectOutputStream and sockets. I have written 2 very simple programs; a server and a client. I am constructing a JFrame on the server and when I hit enter, it will send the JFrame to the client. The Client then creates a new JFrame with the state of the one that was sent. This works great if I am communicating from Windows to Windows, but if I have the server on Unix and the Client on Windows, I get 2 errors. On the Server I get: "java.io.IOException: There is no process to read data written to a pipe.
at java.net.SocketOutputStream.socketWrite(Native Method)
at java.net.SocketOutputStream.write(SocketOutputStream.java:95)
at java.io.ObjectOutputStream.drain(ObjectOutputStream.java:1240)
at java.io.ObjectOutputStream.setBlockData(ObjectOutputStream.java:1264)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:385)
at ReplicateServer.<init>(ReplicateServer.java:37)
at ReplicateServer.main(ReplicateServer.java:50)"
On the client I get:
"java.io.InvalidClassException: javax.swing.JFrame; Local class not compatible: stream c
lassdesc serialVersionUID=-7491023444496277500 local class serialVersionUID=91968438219
42654843
at java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:523)
at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:567)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:936)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at ReplicateClient.<init>(ReplicateClient.java:20)
at ReplicateClient.main(ReplicateClient.java:46)"
what's interesting is that on the client, you can see that I am getting the JFrame in the stack trace. So it seems that I am at least getting that information from the stream. Is it possible that some, but not all of the JFrame information is getting sent through the stream? Is this a Java/Unix problem? Any ideas on this are greatly appreciated! Thanks!
Barry
Here is the client code:
And here is the server code:
One further note: I thought maybe there is a problem because I was not flushing/closing the stream on the server side. I added the new code, but it did not make any difference.
[ January 21, 2002: Message edited by: Barry Andrews ]