예제 #1
0
  /* Envoi d'un message au client */
  public void SendMsg(String msg) {
    String chargeUtile = msg;
    int taille = chargeUtile.length();
    StringBuffer message = new StringBuffer(String.valueOf(taille) + "#" + chargeUtile);

    try {
      dos.write(message.toString().getBytes());
      dos.flush();
    } catch (IOException e) {
      System.err.println("RunnableTraitement : Erreur d'envoi de msg (IO) : " + e);
    }
  }
  /**
   * Method declaration
   *
   * @param b
   * @throws IOException
   */
  void write(byte b[]) throws IOException {

    mOutput.writeInt(b.length);
    mOutput.write(b);
    mOutput.flush();
  }