Java Stream problems

Discussion in 'OT Technology' started by babygodzilla, Jun 1, 2005.

  1. babygodzilla

    babygodzilla I love rice

    Joined:
    Nov 5, 2001
    Messages:
    3,108
    Likes Received:
    0
    my server sends a string using a PrintWriter and a serialized ArrayList using ObjectOutputStream in this order:

    Code:
    
    PrintWriter printOut = new PrintWriter(socket.getOutputStream(), true);	
    ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream());
    printOut.println("ack");						
    output.writeObject(resultRows);
    the client has a code
    Code:
    System.out.println(cmd);
    thats supposed to print out the "ack." but because the Server creates the ObjectOutputStream before it prints the "ack" the output is as such:

    Code:
    ?ack
    ?java.util.ArrayListx?-?Ö¦a?? ?I ?sizexp   ?w?
    ?[Ljava.lang.String;¡-VtT?{G?  xp   ?t bdmillst Brandont ?Millst ?30t 32.0001
    
    as you can see, it prints out the "ack" along with the serialized ArrayList. im wondering if there is a way around this. it is important that I create the ObjectOutputStream BEFORE i send the "ack." any help (sooner than later) will be much appreciated
     
  2. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    Do it in two transactions, instead of one?
     

Share This Page