Index: src/Fragmentation/Automation/ControllerChoices.hpp
===================================================================
--- src/Fragmentation/Automation/ControllerChoices.hpp	(revision 778abb8ccf156d1308e41e6fad137c7987dc7c8f)
+++ src/Fragmentation/Automation/ControllerChoices.hpp	(revision 0196c62295fdde1b6850b1f16abcdfffe6d46877)
@@ -20,5 +20,6 @@
   ReceiveJobs,
   CheckState,
-  SendResults
+  SendResults,
+  Shutdown
 };
 
Index: src/Fragmentation/Automation/FragmentController.cpp
===================================================================
--- src/Fragmentation/Automation/FragmentController.cpp	(revision 778abb8ccf156d1308e41e6fad137c7987dc7c8f)
+++ src/Fragmentation/Automation/FragmentController.cpp	(revision 0196c62295fdde1b6850b1f16abcdfffe6d46877)
@@ -157,4 +157,36 @@
 }
 
+/** Handle completion of a connect operation.
+ *
+ * \param e error code if something went wrong
+ * \param endpoint_iterator endpoint of the connection
+ */
+void FragmentController::handle_connect_shutdown(const boost::system::error_code& e,
+    boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // Successfully established connection. Give choice.
+    enum ControllerChoices choice = Shutdown;
+    connection_.async_write(choice,
+      boost::bind(&FragmentController::handle_FinishOperation, this,
+      boost::asio::placeholders::error));
+  } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) {
+    // Try the next endpoint.
+    connection_.socket().close();
+    boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+    connection_.socket().async_connect(endpoint,
+      boost::bind(&FragmentController::handle_connect_calc, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+  } else {
+    // An error occurred. Log it and return. Since we are not starting a new
+    // operation the io_service will run out of work to do and the client will
+    // exit.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+}
+
 /** Callback function when operation has been completed.
  *
@@ -339,4 +371,22 @@
 }
 
+/** Internal function to connect to the endpoint of the server asynchronuously.
+ *
+ * We require internal connetion_ and host and service to be set up for this.
+ */
+void FragmentController::connect_shutdown()
+{
+  Info info(__FUNCTION__);
+  // Resolve the host name into an IP address.
+  boost::asio::ip::tcp::resolver::iterator endpoint_iterator = getEndpointIterator();
+  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+
+  // Start an asynchronous connect operation.
+  std::cout << "Connecting to endpoint " << endpoint << " to get results " << std::endl;
+  connection_.socket().async_connect(endpoint,
+    boost::bind(&FragmentController::handle_connect_shutdown, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+}
+
 /** Internal function to disconnect connection_ correctly.
  *
@@ -403,4 +453,15 @@
 }
 
+/** Function to initiate shutdown of server.
+ *
+ */
+void FragmentController::shutdown()
+{
+  // connect
+  connect_shutdown();
+  //disconnect
+  disconnect();
+}
+
 /** Getter for doneJobs.
  *
Index: src/Fragmentation/Automation/FragmentController.hpp
===================================================================
--- src/Fragmentation/Automation/FragmentController.hpp	(revision 778abb8ccf156d1308e41e6fad137c7987dc7c8f)
+++ src/Fragmentation/Automation/FragmentController.hpp	(revision 0196c62295fdde1b6850b1f16abcdfffe6d46877)
@@ -49,4 +49,8 @@
       boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
 
+  /// Handle completion of a Shutdown operation.
+  void handle_connect_shutdown(const boost::system::error_code& e,
+      boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
+
   /// Handle completion of an operation.
   void handle_FinishOperation(const boost::system::error_code& e);
@@ -84,4 +88,7 @@
   void obtainResults();
 
+  /// prepares the server's shutdown
+  void shutdown();
+
   /// get the results for the current jobs
   std::vector<FragmentResult> getResults();
@@ -105,4 +112,7 @@
   /// internal function to connect to server and receive calculated results
   void connect_get();
+
+  /// internal function to connect to server and receive calculated results
+  void connect_shutdown();
 
   /// internal function to disconnect from server
Index: src/Fragmentation/Automation/FragmentScheduler.cpp
===================================================================
--- src/Fragmentation/Automation/FragmentScheduler.cpp	(revision 778abb8ccf156d1308e41e6fad137c7987dc7c8f)
+++ src/Fragmentation/Automation/FragmentScheduler.cpp	(revision 0196c62295fdde1b6850b1f16abcdfffe6d46877)
@@ -228,4 +228,5 @@
   if (!e)
   {
+    bool LaunchNewAcceptor = true;
     // switch over the desired choice read previously
     switch(choice) {
@@ -254,6 +255,4 @@
         boost::bind(&FragmentScheduler::handle_CheckResultState, this,
         boost::asio::placeholders::error, conn));
-
-      initiateControllerSocket();
       break;
     }
@@ -266,6 +265,9 @@
         boost::bind(&FragmentScheduler::handle_SendResults, this,
         boost::asio::placeholders::error, conn));
-
-      initiateControllerSocket();
+      break;
+    }
+    case Shutdown:
+    {
+      LaunchNewAcceptor = false;
       break;
     }
@@ -278,4 +280,12 @@
     choice = NoOperation;
 
+    if (LaunchNewAcceptor) {
+      LOG(1, "Launching new acceptor on socket.");
+      // Start an accept operation for a new Connection.
+      connection_ptr new_conn(new Connection(controller_acceptor_.get_io_service()));
+      controller_acceptor_.async_accept(new_conn->socket(),
+        boost::bind(&FragmentScheduler::handle_AcceptController, this,
+        boost::asio::placeholders::error, new_conn));
+    }
   }
   else
@@ -310,8 +320,4 @@
     if (initiateSocket)
       initiateWorkerSocket();
-    // launch new acceptor of queue has been filled/is full
-    initiateControllerSocket();
-  } else {
-    LOG(1, "INFO: Shutting down controller socket.");
   }
 
Index: src/Fragmentation/Automation/Makefile.am
===================================================================
--- src/Fragmentation/Automation/Makefile.am	(revision 778abb8ccf156d1308e41e6fad137c7987dc7c8f)
+++ src/Fragmentation/Automation/Makefile.am	(revision 0196c62295fdde1b6850b1f16abcdfffe6d46877)
@@ -45,5 +45,5 @@
 AM_CPPFLAGS = ${BOOST_CPPFLAGS} ${CodePatterns_CFLAGS}
 
-bin_PROGRAMS += JobAdder ResultChecker ResultGetter Server Worker
+bin_PROGRAMS += JobAdder ResultChecker ResultGetter Server Shutdowner Worker
 
 CONTROLLERSOURCE = \
@@ -119,4 +119,16 @@
   ${CodePatterns_LIBS}
 
+Shutdowner_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Shutdowner.cpp
+Shutdowner_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
+Shutdowner_CXXFLAGS = $(AM_CPPFLAGS)
+Shutdowner_LDADD = \
+  libMolecuilderFragmentJobs.la \
+  libMolecuilderFragmentationAutomation.la \
+  $(BOOST_ASIO_LIBS) \
+  $(BOOST_SERIALIZATION_LIBS) \
+  $(BOOST_THREAD_LIBS) \
+  $(BOOST_SYSTEM_LIBS) \
+  ${CodePatterns_LIBS}
+
 Worker_SOURCES = $(WORKERSOURCE) $(WORKERHEADER)
 Worker_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
Index: src/Fragmentation/Automation/Shutdowner.cpp
===================================================================
--- src/Fragmentation/Automation/Shutdowner.cpp	(revision 0196c62295fdde1b6850b1f16abcdfffe6d46877)
+++ src/Fragmentation/Automation/Shutdowner.cpp	(revision 0196c62295fdde1b6850b1f16abcdfffe6d46877)
@@ -0,0 +1,74 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * \file Shutdowner.cpp
+ *
+ * This file strongly follows the Serialization example from the boost::asio
+ * library (see client.cpp)
+ *
+ *  Created on: Dez 09, 2011
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// boost asio needs specific operator new
+#include <boost/asio.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <iostream>
+#include <vector>
+
+#include "atexit.hpp"
+#include "CodePatterns/Info.hpp"
+#include "CodePatterns/Log.hpp"
+#include "FragmentController.hpp"
+#include "FragmentJob.hpp"
+#include "FragmentResult.hpp"
+
+
+int main(int argc, char* argv[])
+{
+  // from this moment on, we need to be sure to deeinitialize in the correct order
+  // this is handled by the cleanup function
+  atexit(cleanUp);
+
+  setVerbosity(3);
+
+  size_t Exitflag = 0;
+  try
+  {
+    // Check command line arguments.
+    if (argc != 3)
+    {
+      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
+      return 1;
+    }
+
+    boost::asio::io_service io_service;
+    FragmentController controller(io_service, argv[1], argv[2]);
+
+    controller.shutdown();
+    {
+      Info info("io_service");
+      io_service.run();
+    }
+    Exitflag = controller.getExitflag();
+  }
+  catch (std::exception& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+
+  return Exitflag;
+}
