General information
Title:
Cliente x Server Serialization
Hi everybody!
I am writing a client/Server aplication to exchange security messages from clients connected to the Server.
I am sending all messages in a Serializable Object called Mensagem.
The problem is:
When the cliente writes on The ObjectOutPutStream I can only send all objects that I wrote to the Stream only if I CLOSE the Stream. (but this kill my client).
I have tryed to use the flush() method but it doesn't work.
Any one can help?
Here is my Preliminaary Test Code.
public class cliente
{
public static void main(String[] Args)
{
try
{
Socket minha_socket = new Socket("127.0.0.1",171) ;
ObjectOutputStream oos = new ObjectOutputStream(minha_socket.getOutputStream()) ;
Autenticacao aut = new Autenticacao("Flavio Henrique") ;
Mensagem msg = new Mensagem() ;
msg.setEmissor("Emissor") ;
msg.setDestino("Destino") ;
msg.setMensagem("Eu te amo") ;
oos.writeObject(aut) ;
oos.writeObject(msg) ;
oos.close() ; // kill my conection but send all the objects
// oos.flush() ; // doesn't work
}
catch(Exception e)
{
System.out.println(e.getMessage()) ;
}
}
}
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only