protected void writeMessage(ProtocolMessage msg) throws IOException {
  oos.writeObject(msg);
  oos.flush();
  objectsSent++;
  if (objectsSent >= resetPeriod) {
    objectsSent=0;
    oos.reset();
  }
}

protected void writeMessage ( ProtocolMessage msg ) throws IOException { oos . writeObject ( msg ) ; oos . flush ( ) ; objectsSent ++ ; if ( objectsSent >= resetPeriod ) { objectsSent = 0 ; oos . reset ( ) ; } }
write a message to the network from either side .
