New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add `--no-shutdown` option. #151

wants to merge 1 commit into
base: master
Jump to file or symbol
Failed to load files and symbols.
+17 −1
Diff settings


Just for now

@@ -775,6 +775,19 @@
<option>--no-shutdown</option> (Do not shutdown into half-duplex mode)
<indexterm><primary><option>--no-shutdown</option> (Ncat option)</primary></indexterm>
<para>If this option is passed, Ncat will not invoke shutdown on a
socket aftering seeing EOF on stdin. This is provided for
backward-compatibility with OpenBSD netcat, which exhibits this
behavior when executed with its '-d' option.</para>
@@ -168,6 +168,7 @@ void options_init(void)
o.keepopen = 0;
o.sendonly = 0;
o.recvonly = 0;
o.noshutdown = 0;
o.telnet = 0;
o.linedelay = 0; = 0;
@@ -161,6 +161,7 @@ struct options {
int keepopen;
int sendonly;
int recvonly;
int noshutdown;
int telnet;
int linedelay;
int chat;
@@ -393,7 +393,7 @@ static int ncat_listen_stream(int proto)
receiving anything, we can quit here. */
return 0;
if (!o.noshutdown) shutdown_sockets(SHUT_WR);
if (rc < 0)
return 1;
@@ -286,6 +286,7 @@ int main(int argc, char *argv[])
{"source-port", required_argument, NULL, 'p'},
{"source", required_argument, NULL, 's'},
{"send-only", no_argument, &o.sendonly, 1},
{"no-shutdown", no_argument, &o.noshutdown,1},
{"broker", no_argument, NULL, 0},
{"chat", no_argument, NULL, 0},
{"talk", no_argument, NULL, 0},
ProTip! Use n and p to navigate between commits in a pull request.