Shutdown sending on the socket when stdin closes.
diff --git a/nc.c b/nc.c
index 805bbd4..84c1a81 100644
--- a/nc.c
+++ b/nc.c
@@ -111,6 +111,8 @@
 						exit(0);
 					ofd = fileno(stdout);
 				} else {
+					if (nread == 0)
+						shutdown(sfd, 1);
 					ofd = sfd;
 				}