title: FTP server return code: How to connect with a host using my own TCP server and Linux built-in client
body: <p>In Linux there is a built-in ftp server/client. If you go to the terminal and type "ftp localhost" (Without quotations) there is an immediate connection to the local host with a FTP server return code 220. Then you are asked to input the host's name and password (331). I'm trying to implement my own FTP server to do the exact same thing. As soon as the client receives localhost and port, it must ask for host's name and password, but as soon as I write the password my program just hangs. This is my code to handle the user/password issue:</p>
  
  <pre><code>char login_user[BUFSIZ], login_password[BUFSIZ];
  send(sock, "220\r\n", 5, 0); 
  recv(sock, login_user, BUFSIZ);
  send(sock, "331\r\n", 5, 0);
  recv(sock, login_password, BUFSIZ, 0);
  int x = strncmp(login_user, login_password, BUFSIZ);
  if(x == 0)
  {
      send(sock, "230\r\n", 5, 0);
  } 
  </code></pre>
  
  <p>For a connection to be successful both host name and password must be the same. Sending the FTP server code 230 should establish a connection like it does when using the FTP built-in server. However my program just stops and hangs until I press Ctrl+Z. What am I doing wrong?</p>