title: send() and puts() are mixed together, (programming a FTP server in C)
body: <p>I'm making a FTP server in C. At the client side I'm using FileZilla. My code so far contains only the handshaking part. </p>
  
  <p>The problem I've got is that the strings I print out for the terminal are sent to FileZilla.
  My question is how can I keep these two seperated, i've tried a couple of things, but none of them give the correct result.</p>
  
  <p>This is only a part of my code, but for my question is this the useful part:</p>
  
  <pre><code>while (FOREVER){
      addr_size = sizeof their_addr;
  
      newfd = accept(listener, (struct sockaddr*) &amp;their_addr, &amp;addr_size);
      if (newfd == -1){
          perror("accept");
          continue;
      }
      if ((send(newfd, "220 JEDI FTP is ready", 50, 0)) &lt;= 0)
          perror("error sending");
  
      puts("connection established");
      puts("waiting for user &amp; connection");
    while (!login){
          // username
          if (!user){
              if ((recv(newfd, buffer, BUFFCON, 0)) &lt;= 0){
                  puts("error receiving username");
  
              }
              else{
  
                  if (strstr(buffer, "USER") != NULL){
  
                      if (strstr(buffer, name) != NULL){
  
                          send(newfd, "331 password required", 50, 0);
                          puts("username correct");
  
                          user = 1;
                      }
                      else{
                          puts("username incorrect");
                          send(newfd, "430 username incorrect", 50, 0);
                      }//else
                  }//if
              }//else
          }//if user
  </code></pre>
  
  <p>And this is the output in FileZilla:</p>
  
  <ul>
  <li>Status:   Adres bepalen van localhost</li>
  <li>Status:   Verbinden met [::1]:21...</li>
  <li>Status:   Verbinding aangemaakt, welkomstbericht afwachten...</li>
  <li>Antwoord: 220 JEDI FTP is ready</li>
  <li>Commando: USER yoda</li>
  <li>Antwoord: connection established</li>
  <li>Fout: Kan niet verbinden met server</li>
  </ul>
  
  <p>So instead of sending "331 password required" it sends "connection established"</p>
  
  <p>Hope you can help me with this, Thanks a lot.</p>