title: Object stream I/O issue, client object not updated
body: <p>i'm working a client-server based game. The game is mainly caracterized by a Grid object which must be synchronized between clients. To do that I use the Object I/O Streams over Sockets.</p>
  
  <p>However i encounter an issue during the synchronization process. The Grid is sent and recieved by all clients but its state is not modified after the first upload to each client. </p>
  
  <p>I mean by that that clients do recieve the object in its present state when they connect but subsequent receiptions (initiated by either another client connection or previous client moves) don't present any modification over the initial sent state...</p>
  
  <p>here are (stripped-down) snippets of the server side code:</p>
  
  <pre><code>while(true) //continuously accept new connections
       {
       //wait incoming connection, and accept it   
       Socket newSocket = serverListener.accept(); 
  
       //create player details and save it in hashtable
       Player newPlayer = new Player(newSocket); //streams saved here
       Players.put(newPlayer); 
  
       //update all clients
       sendGridToAll(); 
       }
  </code></pre>
  
  <p>The Player class constructor:</p>
  
  <pre><code>public Player(Socket s) throws IOException
      {
      this.Tx         = new ObjectOutputStream(socket.getOutputStream());
      this.Rx         = new DataInputStream(socket.getInputStream());
      }
  </code></pre>
  
  <p>The SendToAll method:</p>
  
  <pre><code>public void sendGridToAll()
      {
      synchronized(Players) //do nothing while players HT is being modified
          {
          for(Enumeration e = Players.elements(); e.hasMoreElements(); )
              {
              Player tmpPlayer = (Player)e.nextElement();
              ObjectOutputStream tmpTx = tmpPlayer.getTx();
  
              try {
                  tmpTx.writeObject(grid);
                  }
              catch(IOException ex) 
                  {
                  ex.printStackTrace();
                  }                
              }
          print.log("Grid update sent");
          }
      }
  </code></pre>
  
  <p>and here is the client side snippet handling the object reception (ran in a thread):</p>
  
  <pre><code>public void run()
      {
      ObjectInputStream RX = new ObjectInputStream(socket.getInputStream());   
  
      while(true)
          {
          try 
              {
              RX_grid = (Grid)RX.readObject();
              }
  
          catch (IOException ex) 
              {
              print.log("IO Error");
              ex.printStackTrace();
              }
  
          catch (ClassNotFoundException ex) 
              {
              print.log("Bad grid class UID");
              }
  
          finally
              {
              print.log("grid recieved");
              c.updateGui(RX_grid);
              }
          }
      }
  </code></pre>
  
  <p>Thank you for your help</p>