question: private Socket openDataConnection ( String cmd ) throws sun . net . ftp . FtpProtocolException , IOException { Socket clientSocket ; if ( passiveMode ) { try { return openPassiveDataConnection ( cmd ) ; } catch ( sun . net . ftp . FtpProtocolException e ) { String errmsg = e . getMessage ( ) ; if ( ! errmsg . startsWith ( "PASV" ) && ! errmsg . startsWith ( "EPSV" ) ) { throw e ; } } } ServerSocket portSocket ; InetAddress myAddress ; String portCmd ; if ( proxy != null && proxy . type ( ) == Proxy . Type . SOCKS ) { throw new sun . net . ftp . FtpProtocolException ( "Passive mode failed" ) ; } portSocket = new ServerSocket ( 0 , 1 , server . getLocalAddress ( ) ) ; try { myAddress = portSocket . getInetAddress ( ) ; if ( myAddress . isAnyLocalAddress ( ) ) { myAddress = server . getLocalAddress ( ) ; } portCmd = "EPRT |" + ( ( myAddress instanceof Inet6Address ) ? "2" : "1" ) + "|" + myAddress . getHostAddress ( ) + "|" + portSocket . getLocalPort ( ) + "|" ; if ( ! issueCommand ( portCmd ) || ! issueCommand ( cmd ) ) { portCmd = "PORT " ; byte [ ] addr = myAddress . getAddress ( ) ; for ( int i = 0 ; i < addr . length ; i ++ ) { portCmd = portCmd + ( addr [ i ] & 0xFF ) + "," ; } portCmd = portCmd + ( ( portSocket . getLocalPort ( ) > > > 8 ) & 0xff ) + "," + ( portSocket . getLocalPort ( ) & 0xff ) ; issueCommandCheck ( portCmd ) ; issueCommandCheck ( cmd ) ; } if ( connectTimeout >= 0 ) { portSocket . setSoTimeout ( connectTimeout ) ; } else { if ( defaultConnectTimeout > 0 ) { portSocket . setSoTimeout ( defaultConnectTimeout ) ; } } clientSocket = portSocket . accept ( ) ; if ( readTimeout >= 0 ) { clientSocket . setSoTimeout ( readTimeout ) ; } else { if ( defaultSoTimeout > 0 ) { clientSocket . setSoTimeout ( defaultSoTimeout ) ; } } } finally { portSocket . close ( ) ; } if ( useCrypto ) { try { clientSocket = sslFact . createSocket ( clientSocket , serverAddr . getHostName ( ) , serverAddr . getPort ( ) , true ) ; } catch ( Exception ex ) { throw new IOException ( ex . getLocalizedMessage ( ) ) ; } } return clientSocket ; }
target:  Opens a data connection with the server according to the set mode (ACTIVE or PASSIVE) then send the command passed as an argument.