while(read_bytes>0) {
unsigned char buf[1000];
read_bytes=read(0,buf,sizeof(buf));
- send_bytes=send(send_fd,buf,sizeof(buf),0);
+ send_bytes=send(send_fd,buf,read_bytes,0);
}
close(send_fd);
+ close(listen_fd);
printf("connection closed ...\n");
printf("%d from %d total bytes sent.\n",send_bytes,read_bytes);
}