Index: util.h
===================================================================
--- util.h	(revision 212)
+++ util.h	(revision 213)
@@ -146,6 +146,7 @@
 extern bool fCommandLine;
 extern string strMiscWarning;
 extern bool fTestNet;
+extern bool fNoListen;
 
 void RandAddSeed();
 void RandAddSeedPerfmon();
Index: net.cpp
===================================================================
--- net.cpp	(revision 212)
+++ net.cpp	(revision 213)
@@ -643,7 +643,9 @@
         FD_ZERO(&fdsetSend);
         FD_ZERO(&fdsetError);
         SOCKET hSocketMax = 0;
-        FD_SET(hListenSocket, &fdsetRecv);
+
+        if(hListenSocket != INVALID_SOCKET)
+            FD_SET(hListenSocket, &fdsetRecv);
         hSocketMax = max(hSocketMax, hListenSocket);
         CRITICAL_BLOCK(cs_vNodes)
         {
@@ -680,7 +682,7 @@
         //
         // Accept new connections
         //
-        if (FD_ISSET(hListenSocket, &fdsetRecv))
+        if (hListenSocket != INVALID_SOCKET && FD_ISSET(hListenSocket, &fdsetRecv))
         {
             struct sockaddr_in sockaddr;
             socklen_t len = sizeof(sockaddr);
@@ -1344,7 +1346,7 @@
 #endif
     printf("addrLocalHost = %s\n", addrLocalHost.ToString().c_str());
 
-    if (fUseProxy || mapArgs.count("-connect"))
+    if (fUseProxy || mapArgs.count("-connect") || fNoListen)
     {
         // Proxies can't take incoming connections
         addrLocalHost.ip = CAddress("0.0.0.0").ip;
Index: init.cpp
===================================================================
--- init.cpp	(revision 212)
+++ init.cpp	(revision 213)
@@ -181,7 +181,8 @@
             "  -rpcpassword=<pw>\t  "   + _("Password for JSON-RPC connections\n") +
             "  -rpcport=<port>  \t\t  " + _("Listen for JSON-RPC connections on <port>\n") +
             "  -rpcallowip=<ip> \t\t  " + _("Allow JSON-RPC connections from specified IP address\n") +
-            "  -rpcconnect=<ip> \t  "   + _("Send commands to node running on <ip>\n");
+            "  -rpcconnect=<ip> \t  "   + _("Send commands to node running on <ip>\n") +
+            "  -nolisten        \t  "   + _("Don't accept connections from outside");
 
 #ifdef USE_SSL
         strUsage += string() +
@@ -211,6 +212,8 @@
     fPrintToDebugger = GetBoolArg("-printtodebugger");
 
     fTestNet = GetBoolArg("-testnet");
+    
+    fNoListen = GetBoolArg("-nolisten");
 
     if (fCommandLine)
     {
@@ -290,10 +293,13 @@
 
     // Bind to the port early so we can tell if another instance is already running.
     string strErrors;
-    if (!BindListenPort(strErrors))
+    if (!fNoListen)
     {
-        wxMessageBox(strErrors, "Bitcoin");
-        return false;
+        if (!BindListenPort(strErrors))
+        {
+            wxMessageBox(strErrors, "Bitcoin");
+            return false;
+        }
     }
 
     //
Index: util.cpp
===================================================================
--- util.cpp	(revision 212)
+++ util.cpp	(revision 213)
@@ -17,11 +17,11 @@
 bool fCommandLine = false;
 string strMiscWarning;
 bool fTestNet = false;
+bool fNoListen = false;
 
 
 
 
-
 // Workaround for "multiple definition of `_tls_used'"
 // http://svn.boost.org/trac/boost/ticket/4258
 extern "C" void tss_cleanup_implemented() { }
