diff -urN netcat-0.7.1/src/misc.c netcat-0.7.1-patched/src/misc.c
--- netcat-0.7.1/src/misc.c	2004-01-03 16:42:07.000000000 +0000
+++ netcat-0.7.1-patched/src/misc.c	2007-11-01 14:47:59.000000000 +0000
@@ -341,6 +341,7 @@
 "  -V, --version              output version information and exit\n"
 "  -x, --hexdump              hexdump incoming and outgoing traffic\n"
 "  -w, --wait=SECS            timeout for connects and final net reads\n"
+"  -W, --lingertime=SECS      timeout for SO LINGER\n"
 "  -z, --zero                 zero-I/O mode (used for scanning)\n"));
   printf("\n");
   printf(_("Remote port number can also be specified as range.  "
diff -urN netcat-0.7.1/src/netcat.c netcat-0.7.1-patched/src/netcat.c
--- netcat-0.7.1/src/netcat.c	2003-08-28 18:20:25.000000000 +0100
+++ netcat-0.7.1-patched/src/netcat.c	2007-11-01 14:47:59.000000000 +0000
@@ -59,6 +59,7 @@
 char *opt_outputfile = NULL;	/* hexdump output file */
 char *opt_exec = NULL;		/* program to exec after connecting */
 nc_proto_t opt_proto = NETCAT_PROTO_TCP; /* protocol to use for connections */
+int opt_linger_time = 0;
 
 
 /* signal handling */
@@ -213,10 +214,11 @@
 	{ "hexdump",	no_argument,		NULL, 'x' },
 	{ "wait",	required_argument,	NULL, 'w' },
 	{ "zero",	no_argument,		NULL, 'z' },
+    { "lingertime", required_argument, NULL, 'W' },
 	{ 0, 0, 0, 0 }
     };
 
-    c = getopt_long(argc, argv, "cde:g:G:hi:lL:no:p:P:rs:S:tTuvVxw:z",
+    c = getopt_long(argc, argv, "cde:g:G:hi:lL:no:p:P:rs:S:tTuvVxw:W:z",
 		    long_options, &option_index);
     if (c == -1)
       break;
@@ -340,6 +342,11 @@
 	ncprint(NCPRINT_ERROR | NCPRINT_EXIT, _("Invalid wait-time: %s"),
 		optarg);
       break;
+    case 'W':           /* linger time in seconds, 0 means no timeout */
+        opt_linger_time = atoi(optarg);
+        if (opt_linger_time < 0)
+            ncprint(NCPRINT_ERROR | NCPRINT_EXIT, _("Invalid linger-time: %s"),optarg);
+        break;
     case 'x':			/* hexdump traffic */
       opt_hexdump = TRUE;
       break;
diff -urN netcat-0.7.1/src/network.c netcat-0.7.1-patched/src/network.c
--- netcat-0.7.1/src/network.c	2004-01-03 16:42:07.000000000 +0000
+++ netcat-0.7.1-patched/src/network.c	2007-11-01 14:47:59.000000000 +0000
@@ -357,7 +357,7 @@
 
   /* don't leave the socket in a TIME_WAIT state if we close the connection */
   fix_ling.l_onoff = 1;
-  fix_ling.l_linger = 0;
+  fix_ling.l_linger = opt_linger_time;
   ret = setsockopt(sock, SOL_SOCKET, SO_LINGER, &fix_ling, sizeof(fix_ling));
   if (ret < 0) {
     close(sock);		/* anyway the socket was created */
diff -urN netcat-0.7.1/src/proto.h netcat-0.7.1-patched/src/proto.h
--- netcat-0.7.1/src/proto.h	2004-01-03 16:42:07.000000000 +0000
+++ netcat-0.7.1-patched/src/proto.h	2007-11-01 14:47:59.000000000 +0000
@@ -56,7 +56,7 @@
 extern nc_mode_t netcat_mode;
 extern bool opt_eofclose, opt_debug, opt_numeric, opt_random, opt_hexdump,
 	opt_telnet, opt_zero;
-extern int opt_interval, opt_verbose, opt_wait;
+extern int opt_interval, opt_verbose, opt_wait, opt_linger_time;
 extern char *opt_outputfile;
 extern nc_proto_t opt_proto;
 extern FILE *output_fp;
