title: Java invalid stream header: 7371007E
body: <p>I am building a client-server application. Now I want to forward the message from a client to all other client with this code:</p>
  
  <pre><code>ArrayList&lt;User&gt; usrs = _usrHandler.getUsers();
  for(User usr : usrs) {
      if(!usr.getSocket().equals(_connection)) {
          usr._oOut.writeObject(new CommunicationMessage(this._comMsg.getMessage(), CommunicationMessage.MSG, 
                                                      this._comMsg.getUser()));
   }
  }
  </code></pre>
  
  <p>On the client side the program is listening for messages. It throws this exception:</p>
  
  <pre><code>java.io.StreamCorruptedException: invalid stream header: 7371007E
      at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
      at java.io.ObjectInputStream.&lt;init&gt;(ObjectInputStream.java:280)
      at Connection$MessageListener.run(Connection.java:126)
      at java.lang.Thread.run(Thread.java:637)
  </code></pre>
  
  <p>MessageListener:</p>
  
  <pre><code>             while(this._loop) {
   this._comMsg = (CommunicationMessage) this._dataInput.readObject();
  
   SimpleAttributeSet attr = new SimpleAttributeSet();
   attr.addAttribute(StyleConstants.CharacterConstants.Bold, Boolean.TRUE);
   attr.addAttribute(StyleConstants.CharacterConstants.Foreground, _comMsg.getUser().getColor());
  
   messageClient.addMessage(_comMsg.getUser().getNickName() + ": ", attr);
   messageClient.addMessage(_comMsg.getMessage(), _comMsg.getUser().getColor());
  
   _comMsg = null;
  }
  </code></pre>
  
  <p>Does someone see the error?</p>