Stream problems


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Stream problems

  1. #1
    Join Date
    Jun 2005
    Posts
    2

    Stream problems

    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. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Are you in charge of the clients code, can you modify the process on the client side ?
    eschew obfuscation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center