diff -Nurb netcat-0.7.1/src/core.c netcat-0.7.1-dccp/src/core.c
--- netcat-0.7.1/src/core.c	2004-01-03 17:42:07.000000000 +0100
+++ netcat-0.7.1-dccp/src/core.c	2006-09-12 13:28:13.000000000 +0200
@@ -414,7 +414,184 @@
   int sock_listen, sock_accept, timeout = ncsock->timeout;
   debug_v(("core_tcp_listen(ncsock=%p)", (void *)ncsock));
 
-  sock_listen = netcat_socket_new_listen(PF_INET, &ncsock->local_host.iaddrs[0],
+  sock_listen = netcat_socket_new_listen(PF_INET, SOCK_STREAM,
+		  	&ncsock->local_host.iaddrs[0],
+			ncsock->local_port.netnum);
+  if (sock_listen < 0)
+    ncprint(NCPRINT_ERROR | NCPRINT_EXIT,
+	    _("Couldn't setup listening socket (err=%d)"), sock_listen);
+
+  /* if the port was set to 0 this means that it is assigned randomly by the
+     OS.  Find out which port they assigned to us. */
+  if (ncsock->local_port.num == 0) {
+    int ret;
+    struct sockaddr_in myaddr;
+    unsigned int myaddr_len = sizeof(myaddr);
+
+    ret = getsockname(sock_listen, (struct sockaddr *)&myaddr, &myaddr_len);
+    if (ret < 0) {
+      close(sock_listen);
+      return -1;
+    }
+    netcat_getport(&ncsock->local_port, NULL, ntohs(myaddr.sin_port));
+  }
+
+  ncprint(NCPRINT_VERB2, _("Listening on %s"),
+	netcat_strid(&ncsock->local_host, &ncsock->local_port));
+  while (TRUE) {
+    struct sockaddr_in my_addr;
+    unsigned int my_len = sizeof(my_addr);	/* this *IS* socklen_t */
+
+    sock_accept = netcat_socket_accept(sock_listen, timeout);
+    /* reset the timeout to the "use remaining time" value (see network.c file)
+       if it exited with timeout we also return this function, so losing the
+       original value is not a bad thing. */
+    timeout = -1;
+
+    /* failures in netcat_socket_accept() cause this function to return */
+    if (sock_accept < 0)
+      return -1;
+
+    /* FIXME: i want a library function like netcat_peername() that fetches it
+       and resolves with netcat_resolvehost(). */
+    getpeername(sock_accept, (struct sockaddr *)&my_addr, &my_len);
+
+    /* if a remote address (and optionally some ports) have been specified we
+       assume it as the only ip and port that it is allowed to connect to
+       this socket */
+
+    if ((ncsock->host.iaddrs[0].s_addr && memcmp(&ncsock->host.iaddrs[0],
+	 &my_addr.sin_addr, sizeof(ncsock->host.iaddrs[0]))) ||
+	(netcat_flag_count() && !netcat_flag_get(ntohs(my_addr.sin_port)))) {
+      ncprint(NCPRINT_VERB2, _("Unwanted connection from %s:%hu (refused)"),
+	      netcat_inet_ntop(&my_addr.sin_addr), ntohs(my_addr.sin_port));
+      goto refuse;
+    }
+    ncprint(NCPRINT_VERB1, _("Connection from %s:%hu"),
+	    netcat_inet_ntop(&my_addr.sin_addr), ntohs(my_addr.sin_port));
+
+    /* with zero I/O mode we don't really accept any connection */
+    if (opt_zero)
+      goto refuse;
+
+    /* we have got our socket, now exit the loop */
+    break;
+
+ refuse:
+    shutdown(sock_accept, 2);
+    close(sock_accept);
+    continue;
+  }			/* end of infinite accepting loop */
+
+  /* we don't need a listening socket anymore */
+  close(sock_listen);
+  return sock_accept;
+}				/* end of core_tcp_listen() */
+
+/* ... */
+
+/* Creates an outgoing DCCP connection to the remote host.  If a local address
+   or port is also specified in the socket object, it calls bind(2).
+   Returns the new socket descriptor or -1 on error. */
+
+static int core_dccp_connect(nc_sock_t *ncsock)
+{
+  int ret, sock, timeout = ncsock->timeout;
+  struct timeval timest;
+  fd_set outs;
+  debug_v(("core_dccp_connect(ncsock=%p)", (void *)ncsock));
+
+  /* since we are nonblocking now, we could start as many connections as we
+     want but it's not a great idea connecting more than one host at time.
+     Also don't specify the local address if it's not really needed, so we can
+     avoid one bind(2) call. */
+  sock = netcat_socket_new_connect(PF_INET, SOCK_DCCP,
+	&ncsock->host.iaddrs[0], ncsock->port.netnum,
+	(ncsock->local_host.iaddrs[0].s_addr ? &ncsock->local_host.iaddrs[0] :
+	NULL), ncsock->local_port.netnum);
+
+  if (sock < 0)
+    ncprint(NCPRINT_ERROR | NCPRINT_EXIT, "Couldn't create connection (err=%d): %s",
+	    sock, strerror(errno));
+
+  /* initialize select()'s variables */
+  FD_ZERO(&outs);
+  FD_SET(sock, &outs);
+  timest.tv_sec = timeout;
+  timest.tv_usec = 0;
+
+  ret = select(sock + 1, NULL, &outs, NULL, (timeout > 0 ? &timest : NULL));
+  if (ret > 0) {
+    int ret, get_ret;
+    unsigned int get_len = sizeof(get_ret);	/* socklen_t */
+
+    /* ok, select([single]), so sock must have triggered this */
+    assert(FD_ISSET(sock, &outs));
+
+    /* fetch the errors of the socket and handle system request errors */
+    ret = getsockopt(sock, SOL_SOCKET, SO_ERROR, &get_ret, &get_len);
+    if (ret < 0)
+      ncprint(NCPRINT_ERROR | NCPRINT_EXIT, "Critical system request failed: %s",
+	      strerror(errno));
+
+    /* POSIX says that SO_ERROR expects an int, so my_len must be untouched */
+    assert(get_len == sizeof(get_ret));
+
+    /* FIXME: the error Broken Pipe should probably not stop here */
+    debug_v(("Connection returned errcode=%d (%s)", get_ret, strerror(get_ret)));
+    if (get_ret > 0) {
+      char tmp;
+
+      /* Ok, select() returned a write event for this socket AND getsockopt()
+         said that some error happened.  This mean that EOF is expected. */
+      ret = read(sock, &tmp, 1);
+      assert(ret == 0);
+      /* FIXME: see the TODO entry about false error detection */
+
+      shutdown(sock, 2);
+      close(sock);
+      ncsock->fd = -1;
+      errno = get_ret;		/* value returned by getsockopt(SO_ERROR) */
+      return -1;
+    }
+
+    /* everything went fine, we have the socket */
+    ncprint(NCPRINT_VERB1, _("%s open"), netcat_strid(&ncsock->host,
+						      &ncsock->port));
+    return sock;
+  }
+  else if (ret) {
+    /* Terminated by a signal. Silently exit */
+    if (errno == EINTR)
+      exit(EXIT_FAILURE);
+    /* The error seems to be a little worse */
+    ncprint(NCPRINT_ERROR | NCPRINT_EXIT, "Critical system request failed: %s",
+	    strerror(errno));
+  }
+
+  /* select returned 0, this means connection timed out for our timing
+     directives (in fact the socket has a longer timeout usually, so we need
+     to abort the connection try, set the proper errno and return */
+  shutdown(sock, 2);
+  close(sock);
+  errno = ETIMEDOUT;
+  return -1;
+}				/* end of core_dccp_connect() */
+
+/* This function loops inside the accept() loop until a *VALID* connection is
+   fetched.  If an unwanted connection arrives, it is shutdown() and close()d.
+   If zero I/O mode is enabled, ALL connections are refused and it stays
+   unconditionally in listen mode until timeout elapses, if given, otherwise
+   forever.
+   Returns: The new socket descriptor for the fetched connection */
+
+static int core_dccp_listen(nc_sock_t *ncsock)
+{
+  int sock_listen, sock_accept, timeout = ncsock->timeout;
+  debug_v(("core_dccp_listen(ncsock=%p)", (void *)ncsock));
+
+  sock_listen = netcat_socket_new_listen(PF_INET, SOCK_DCCP,
+		  	&ncsock->local_host.iaddrs[0],
 			ncsock->local_port.netnum);
   if (sock_listen < 0)
     ncprint(NCPRINT_ERROR | NCPRINT_EXIT,
@@ -497,6 +674,8 @@
     return ncsock->fd = core_tcp_connect(ncsock);
   else if (ncsock->proto == NETCAT_PROTO_UDP)
     return ncsock->fd = core_udp_connect(ncsock);
+  else if (ncsock->proto == NETCAT_PROTO_DCCP)
+    return ncsock->fd = core_dccp_connect(ncsock);
   else
     abort();
 
@@ -513,6 +692,8 @@
     return ncsock->fd = core_tcp_listen(ncsock);
   else if (ncsock->proto == NETCAT_PROTO_UDP)
     return ncsock->fd = core_udp_listen(ncsock);
+  else if (ncsock->proto == NETCAT_PROTO_DCCP)
+    return ncsock->fd = core_dccp_listen(ncsock);
   else
     abort();
 
diff -Nurb netcat-0.7.1/src/misc.c netcat-0.7.1-dccp/src/misc.c
--- netcat-0.7.1/src/misc.c	2004-01-03 17:42:07.000000000 +0100
+++ netcat-0.7.1-dccp/src/misc.c	2006-09-12 13:28:13.000000000 +0200
@@ -337,6 +337,7 @@
 #endif
   printf(_(""
 "  -u, --udp                  UDP mode\n"
+"  -D, --dccp                 DCCP mode\n"
 "  -v, --verbose              verbose (use twice to be more verbose)\n"
 "  -V, --version              output version information and exit\n"
 "  -x, --hexdump              hexdump incoming and outgoing traffic\n"
diff -Nurb netcat-0.7.1/src/netcat.c netcat-0.7.1-dccp/src/netcat.c
--- netcat-0.7.1/src/netcat.c	2003-08-28 19:20:25.000000000 +0200
+++ netcat-0.7.1-dccp/src/netcat.c	2006-09-12 13:28:13.000000000 +0200
@@ -208,6 +208,7 @@
 	{ "telnet",	no_argument,		NULL, 't' },
 #endif
 	{ "udp",	no_argument,		NULL, 'u' },
+	{ "dccp",	no_argument,		NULL, 'D' },
 	{ "verbose",	no_argument,		NULL, 'v' },
 	{ "version",	no_argument,		NULL, 'V' },
 	{ "hexdump",	no_argument,		NULL, 'x' },
@@ -216,7 +217,7 @@
 	{ 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:tTuDvVxw:z",
 		    long_options, &option_index);
     if (c == -1)
       break;
@@ -328,6 +329,9 @@
     case 'u':			/* use UDP protocol */
       opt_proto = NETCAT_PROTO_UDP;
       break;
+    case 'D':			/* use DCCP protocol */
+      opt_proto = NETCAT_PROTO_DCCP;
+      break;
     case 'v':			/* be verbose (twice=more verbose) */
       opt_verbose++;
       break;
diff -Nurb netcat-0.7.1/src/netcat.h netcat-0.7.1-dccp/src/netcat.h
--- netcat-0.7.1/src/netcat.h	2004-01-03 17:42:07.000000000 +0100
+++ netcat-0.7.1-dccp/src/netcat.h	2006-09-12 13:28:13.000000000 +0200
@@ -133,6 +133,10 @@
 typedef unsigned short in_port_t;
 #endif
 
+#ifndef SOCK_DCCP
+#define SOCK_DCCP 6
+#endif
+
 /* Netcat basic operating modes */
 
 typedef enum {
@@ -147,7 +151,8 @@
 typedef enum {
   NETCAT_PROTO_UNSPEC,
   NETCAT_PROTO_TCP,
-  NETCAT_PROTO_UDP
+  NETCAT_PROTO_UDP,
+  NETCAT_PROTO_DCCP,
 } nc_proto_t;
 
 /* used for queues buffering and data tracking purposes.  The `head' field is
diff -Nurb netcat-0.7.1/src/network.c netcat-0.7.1-dccp/src/network.c
--- netcat-0.7.1/src/network.c	2004-01-03 17:42:07.000000000 +0100
+++ netcat-0.7.1-dccp/src/network.c	2006-09-12 14:25:08.000000000 +0200
@@ -30,6 +30,13 @@
 #include <netdb.h>		/* hostent, gethostby*, getservby* */
 #include <fcntl.h>		/* fcntl() */
 
+#define DCCP_SOCKOPT_PACKET_SIZE	1
+#define DCCP_SOCKOPT_SERVICE		2
+#define SOCK_DCCP	6
+#define IPPROTO_DCCP	33
+#define SOL_DCCP	269
+
+
 /* Fills the structure pointed to by `dst' with the valid DNS information
    for the target identified by `name', which can be an hostname or a valid IP
    address in the dotted notation.
@@ -351,9 +358,22 @@
   int sock, ret, sockopt;
   struct linger fix_ling;
 
+  if (type != SOCK_DCCP) {
   sock = socket(domain, type, 0);
   if (sock < 0)
     return -1;
+  }
+  else {
+    sock = socket(domain, type, IPPROTO_DCCP);
+    if (sock < 0)
+      return -1;
+    sockopt = 1;
+    ret = setsockopt(sock, SOL_DCCP, DCCP_SOCKOPT_SERVICE, &sockopt, sizeof(sockopt));
+    if (ret < 0) {
+      close(sock);
+      return -2;
+    }
+  }
 
   /* don't leave the socket in a TIME_WAIT state if we close the connection */
   fix_ling.l_onoff = 1;
@@ -467,9 +487,9 @@
   return ret;
 }
 
-/* Creates a listening TCP (stream) socket already bound and in listening
-   state in the specified `domain', ready for accept(2) or select(2).  The
-   `addr' parameter is optional and specifies the local interface at which
+/* Creates a listening TCP (stream) or DCCP (dccp) socket already bound and in
+   listening state in the specified `domain', ready for accept(2) or select(2).
+   The `addr' parameter is optional and specifies the local interface at which
    socket should be bound to.  If `addr' is NULL, it defaults to INADDR_ANY,
    which is a valid value as well.
    Returns the descriptor referencing the listening socket on success,
@@ -477,7 +497,7 @@
    netcat_socket_new()), -3 if the bind(2) call failed, or -4 if the listen(2)
    call failed. */
 
-int netcat_socket_new_listen(int domain, const struct in_addr *addr,
+int netcat_socket_new_listen(int domain, int type, const struct in_addr *addr,
 			     in_port_t port)
 {
   int sock, ret, my_family;
@@ -502,7 +522,7 @@
     memcpy(&my_addr.sin_addr, addr, sizeof(my_addr.sin_addr));
 
   /* create the socket and fix the options */
-  sock = netcat_socket_new(domain, SOCK_STREAM);
+  sock = netcat_socket_new(domain, type);
   if (sock < 0)
     return sock;		/* forward the error code */
 
diff -Nurb netcat-0.7.1/src/proto.h netcat-0.7.1-dccp/src/proto.h
--- netcat-0.7.1/src/proto.h	2004-01-03 17:42:07.000000000 +0100
+++ netcat-0.7.1-dccp/src/proto.h	2006-09-12 13:28:13.000000000 +0200
@@ -74,7 +74,7 @@
 int netcat_socket_new_connect(int domain, int type, const struct in_addr *addr,
 		in_port_t port, const struct in_addr *local_addr,
 		in_port_t local_port);
-int netcat_socket_new_listen(int domain, const struct in_addr *addr,
+int netcat_socket_new_listen(int domain, int type, const struct in_addr *addr,
 			     in_port_t port);
 int netcat_socket_accept(int fd, int timeout);
 
