protected Socket __openPassiveDataConnection(int command,String arg) throws IOException, FtpExceptionCanNotHaveDataConnection {
  Socket socket;
  if (pasv() != FTPReply.ENTERING_PASSIVE_MODE)   throw new FtpExceptionCanNotHaveDataConnection("pasv() failed. " + getReplyString());
  try {
    __parsePassiveModeReply(getReplyStrings()[0]);
  }
 catch (  MalformedServerReplyException e) {
    throw new FtpExceptionCanNotHaveDataConnection(e.getMessage());
  }
  socket=_socketFactory_.createSocket(__passiveHost,__passivePort);
  if (!FTPReply.isPositivePreliminary(sendCommand(command,arg))) {
    socket.close();
    return null;
  }
  if (__remoteVerificationEnabled && !verifyRemote(socket)) {
    InetAddress host1, host2;
    host1=socket.getInetAddress();
    host2=getRemoteAddress();
    socket.close();
    throw new FtpExceptionCanNotHaveDataConnection("Host attempting data connection " + host1.getHostAddress() + " is not same as server "+ host2.getHostAddress()+ " So we intentionally close it for security precaution.");
  }
  if (__dataTimeout >= 0)   socket.setSoTimeout(__dataTimeout);
  return socket;
}

protected Socket __openPassiveDataConnection ( int command , String arg ) throws IOException , FtpExceptionCanNotHaveDataConnection { Socket socket ; if ( pasv ( ) != FTPReply . ENTERING_PASSIVE_MODE ) throw new FtpExceptionCanNotHaveDataConnection ( "pasv() failed. " + getReplyString ( ) ) ; try { __parsePassiveModeReply ( getReplyStrings ( ) [ 0 ] ) ; } catch ( MalformedServerReplyException e ) { throw new FtpExceptionCanNotHaveDataConnection ( e . getMessage ( ) ) ; } socket = _socketFactory_ . createSocket ( __passiveHost , __passivePort ) ; if ( ! FTPReply . isPositivePreliminary ( sendCommand ( command , arg ) ) ) { socket . close ( ) ; return null ; } if ( __remoteVerificationEnabled && ! verifyRemote ( socket ) ) { InetAddress host1 , host2 ; host1 = socket . getInetAddress ( ) ; host2 = getRemoteAddress ( ) ; socket . close ( ) ; throw new FtpExceptionCanNotHaveDataConnection ( "Host attempting data connection " + host1 . getHostAddress ( ) + " is not same as server " + host2 . getHostAddress ( ) + " So we intentionally close it for security precaution." ) ; } if ( __dataTimeout >= 0 ) socket . setSoTimeout ( __dataTimeout ) ; return socket ; }
open a passive data connection socket
