title: How to download file via FTP java code
body: <p>Need to download file from server using FTP, without using existing libraries and 3rd parity solutions. I manage to connect and login to server, post type mode of transfere (ASCII) and passiv mode so I get port number and opened new ServerSocket(port). But when I call RETR fileName, my program blocks on InputStream.readLine() (on reading server port, means server is not responding ) Is there something before calling RETR comand that I forgot to do?</p>
  
  <pre><code>//PASV
  outputStream.println("pasv");    
  
  //227 Entering Passive Mode(a1,a2,a3,a4,p1,p2)
  String response = inputStream.readLine();   
  
  // port = p1*256 + p2
  ServerSocket serverSocket = new ServerSocket(port);
  
  //RETR fileName 
  outputStream.println("retr "+ fileName);
  
  //server no answer
  String reply = inputStream.readLine()
  </code></pre>