Vector in ObjectOutputStram
843790May 23 2006 — edited May 23 2006Hi,
I'm trying to send a Vector trough an ObjectOutputStream, this works but my last added element is never recieved @client side but when I send it with Vector.toString() he recieves all the elements
This is the piece of code where I recieve my Vector as you can see I read the vector and after that I read in the vector as a string
if(message.equals(Constanten.REPLY_REQUEST_USER))
{
output.writeObject(controller.getEmailAdres());
output.flush();
ContactPersonen = (Vector)input.readObject();
String test = (String)input.readObject();
ContactPersonenStaanKlaar = true;
}}
Here is were I send my Vector (first as a vector afterwards as a String)
if(message.equals(Constanten.REQUEST_USERS))
{
output.writeObject(Constanten.REPLY_REQUEST_USER);
//Get Email Adres
message = (String)input.readObject();
//Write Vector (Contactlist)
Vector users = server.getUsersContactList(message);
System.out.println("-------------------------");
for(int x=0; x< users.size(); x++)
{
System.out.println(users.elementAt(x));
}
System.out.println("--------------------------");
output.writeObject(users);
System.out.println(users.toString());
output.writeObject(users.toString());
//output.flush();
}
Anyone any idea ?