-1
while ((c = accept()> 0){
    // Do whatever a web server does.
    printf("got connected\n");





    recv_buf[i]='\0';

        printf("%s\n" , recv_buf);
    printf("input received");
 }

this while loop receives the message and prints the message but did not print the line " input received", why is it like that and how do i fix it?

1 Answers1

0

I'm guessing you haven't seen the message printed out more than once. It's likely that "input received" is still buffered in stdout. You should either call fflush(stdout); or easier, just always use stderr for your debugging, since it's unbuffered by default.

If you've seen more than one message printed out without seeing "input received", then the problem would be something more insidious, but this seems unlikely.

xaxxon
  • 19,189
  • 5
  • 50
  • 80