コード例 #1
0
  /**
   * Recibir Tamaño del Fichero
   *
   * @return lSize Tamaño del Fichero
   */
  private long receiveFileSize() throws IOException {
    long lFileSize = 0;
    try {
      Buffer buf = new Buffer(8);

      // Obtener la longitud del nombre del fichero...
      this.id_socketIn.read(buf.getBuffer());

      lFileSize = buf.getLong(0);

      Log.log("Size: " + lFileSize + newline, "");
    } finally {
      return lFileSize;
    }
  }
コード例 #2
0
  /**
   * Recibir Identificador de cFtp ClusterNet v1.0
   *
   * @return true si se ha recibido el Identificador de cFtp, false en caso contrario
   */
  private boolean receiveIDFTPMulticast() throws IOException {
    boolean bOK = false;
    try {
      Buffer buf = new Buffer(5);

      // Leer Datos...
      this.id_socketIn.read(buf.getBuffer());

      // Comprobar MAGIC
      if (buf.getInt(0) != 0x6DED757B) return bOK;

      // Comprobar VERSION
      if (buf.getByte(4) != 0x01) return bOK;

      bOK = true;

      Log.log("Iniciando la recepción cFtp...", "");

    } finally {
      return bOK;
    }
  }
コード例 #3
0
  /**
   * Recibir Nombre del Fichero
   *
   * @return sFileName Nombre del Fichero
   */
  private String receiveFileName() throws IOException {
    String sFileName = null;
    byte[] bytes = null;
    try {
      Buffer buf = new Buffer(2);

      int iLong = 0;

      // Obtener la longitud del nombre del fichero...
      this.id_socketIn.read(buf.getBuffer());

      iLong = (int) buf.getShort(0);
      if (iLong > 0) bytes = new byte[iLong];
      this.id_socketIn.read(bytes);

      // Obtener el nombre del fichero...
      sFileName = new String(bytes);

      Log.log(
          "Receiving file: " + sFileName + " from sender: " + this.id_socketIn.getID_Socket(), "");
    } finally {
      return sFileName;
    }
  }