--
[my-code/ivac.git] / stream.c
index da6cc47..1a150e1 100644 (file)
--- a/stream.c
+++ b/stream.c
@@ -70,10 +70,11 @@ int main(int argc, char *argv[]) {
       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);
   }