示例#1
0
  /** Sets remote server to striped passive server mode (SPAS). */
  public HostPortList setStripedPassive() throws IOException, ServerException {
    Command cmd = new Command("SPAS", (controlChannel.isIPv6()) ? "2" : null);
    Reply reply = null;

    try {
      reply = controlChannel.execute(cmd);
    } catch (UnexpectedReplyCodeException urce) {
      throw ServerException.embedUnexpectedReplyCodeException(urce);
    } catch (FTPReplyParseException rpe) {
      throw ServerException.embedFTPReplyParseException(rpe);
    }

    this.gSession.serverMode = GridFTPSession.SERVER_EPAS;
    if (controlChannel.isIPv6()) {
      gSession.serverAddressList = HostPortList.parseIPv6Format(reply.getMessage());
      int size = gSession.serverAddressList.size();
      for (int i = 0; i < size; i++) {
        HostPort6 hp = (HostPort6) gSession.serverAddressList.get(i);
        if (hp.getHost() == null) {
          hp.setVersion(HostPort6.IPv6);
          hp.setHost(controlChannel.getHost());
        }
      }
    } else {
      gSession.serverAddressList = HostPortList.parseIPv4Format(reply.getMessage());
    }
    return gSession.serverAddressList;
  }
示例#2
0
  /** Sets remote server to striped active server mode (SPOR). */
  public void setStripedActive(HostPortList hpl) throws IOException, ServerException {
    Command cmd = new Command("SPOR", hpl.toFtpCmdArgument());

    try {
      controlChannel.execute(cmd);
    } catch (UnexpectedReplyCodeException urce) {
      throw ServerException.embedUnexpectedReplyCodeException(urce);
    } catch (FTPReplyParseException rpe) {
      throw ServerException.embedFTPReplyParseException(rpe);
    }

    this.gSession.serverMode = GridFTPSession.SERVER_EACT;
  }