aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/net/netcat.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/toys/net/netcat.c b/toys/net/netcat.c
index cd05dcf3..3f08b5f7 100644
--- a/toys/net/netcat.c
+++ b/toys/net/netcat.c
@@ -140,6 +140,12 @@ void netcat_main(void)
}
sockfd = xsocket(family, type, 0);
+
+ {
+ int val = 1;
+ xsetsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
+ }
+
if (bind(sockfd, address, bind_addrlen))
perror_exit("bind");
}