void print_param(int sd) { char buf[HOST_BUF_LEN]; int read_b; while( read_b = read(STDIN_FILENO, &buf, sizeof(buf)) ){ if ((send(sd, buf, read_b, 0)) == -1) { perror("send"); } perror("send"); } sleep(1); close (sd); }