Re: object output stream on socket
From: Maria Gaitani (M.Gaitani_at_warwick.ac.uk)
Date: 02/22/04
- Next message: Ali: "Simple chat problem - really stuck! Please help me :o)"
- Previous message: Silvio Bierman: "Re: object output stream on socket"
- In reply to: Maria Gaitani: "object output stream on socket"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 22 Feb 2004 14:57:06 -0000
Thank you very much for your time and help !!
I will try that straight away !
Maria
"Maria Gaitani" <M.Gaitani@warwick.ac.uk> wrote in message
news:403820bb$0$24603$fa0fcedb@lovejoy.zen.co.uk...
> Hi!
>
> I have made a client and a server which are supposed to communicate by
> sending java objects. They don't.
> I have managed to send an object from the client to the server. But
> continuing after that I can't do the opposite. I want the program to send
an
> object-reply from the server to the client. But on this step boths sides
> throw a socket exception.
> From println's I have figured out that it can't set up on either side the
> corresponding stream: output stream for the server and input stream for
the
> client.
> I have closed the input stream on the server and the output stream on the
> client from the first sending of the object.
> The object that's being sent does implement serializable.
>
> The blocks of code of setting up the streams are below.
> Any help would be greatly appreciated.
> Maria
>
> Here is the code the client is running to receive (it throws the exception
> just after the println statement):
> System.out.println("in receive");
> InputStream in = client.getInputStream();
> ObjectInputStream receive = new ObjectInputStream(in);
> Object received = receive.readObject();
> receive.close();
> in.close();
>
> Here is the code the server is running to send (it throws the exception
just
> after the println statement):
>
> System.out.println("in send");
> OutputStream out = connection.getOutputStream();
> System.out.println("got stream one");
> ObjectOutputStream sendStream = new ObjectOutputStream(out);
> sendStream.writeObject(toSend);
> sendStream.close();
> out.close();
>
>
- Next message: Ali: "Simple chat problem - really stuck! Please help me :o)"
- Previous message: Silvio Bierman: "Re: object output stream on socket"
- In reply to: Maria Gaitani: "object output stream on socket"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|