diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index 28b2cbe054a47193938daca5b78500375dd9dab7..62e1b059f32350cb3e3702de2e67f580bc3ae06d 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -209,6 +209,14 @@ void Get_Options(int argc, char *argv[])
         CTX.batch = 4;
         i++;
       }
+      else if(!strcmp(argv[i] + 1, "socket")) {
+        i++;        
+        if(argv[i] != NULL)
+          CTX.solver.socket_name = argv[i++];
+        else
+	  Msg::Fatal("Missing string");
+        CTX.batch = 5;
+      }
       else if(!strcmp(argv[i] + 1, "part")) {
         CTX.batchAfterMesh = 1;
         i++;
diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp
index bc6454d8f13269d756f036dced1b4a1cb23f8d04..d782118fe7ec462d756263a9627aea679bcc6cd6 100644
--- a/Common/Gmsh.cpp
+++ b/Common/Gmsh.cpp
@@ -17,6 +17,7 @@
 #include "Field.h"
 #include "Context.h"
 #include "Partition.h"
+#include "GmshDaemon.h"
 
 #if !defined(HAVE_NO_POST)
 #include "PluginManager.h"
@@ -89,7 +90,10 @@ int GmshBatch()
       Msg::Error("Invalid background mesh (no view)");
   }
 #endif
-  if(CTX.batch == 4) {
+  if(CTX.batch == 5) {
+    GmshDaemon(CTX.solver.socket_name);
+  }
+  else if(CTX.batch == 4) {
     AdaptMesh(GModel::current());
     CreateOutputFile(CTX.output_filename, CTX.mesh.format);
   }
diff --git a/Common/GmshDaemon.cpp b/Common/GmshDaemon.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3623490db69a4ba76898fdeeb75b24ceafc6d12f
--- /dev/null
+++ b/Common/GmshDaemon.cpp
@@ -0,0 +1,16 @@
+// Gmsh - Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
+//
+// See the LICENSE.txt file for license information. Please report all
+// bugs and problems to <gmsh@geuz.org>.
+
+#include "Message.h"
+#include "GmshSocket.h"
+
+int GmshDaemon(std::string socket)
+{
+  Msg::Info("Gmsh daemon running on socket %s", socket.c_str());
+  while(1){
+    ;
+  }
+  return 0;
+}
diff --git a/Common/GmshDaemon.h b/Common/GmshDaemon.h
new file mode 100644
index 0000000000000000000000000000000000000000..8d0f045df8b2ad8710fd8dab383ab01ce0f94b55
--- /dev/null
+++ b/Common/GmshDaemon.h
@@ -0,0 +1,14 @@
+// Gmsh - Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
+//
+// See the LICENSE.txt file for license information. Please report all
+// bugs and problems to <gmsh@geuz.org>.
+
+#ifndef _GMSH_DAEMON_H_
+#define _GMSH_DAEMON_H_
+
+#include <string>
+
+int GmshDaemon(std::string socket);
+
+#endif
+
diff --git a/Fltk/GmshSocket.h b/Common/GmshSocket.h
similarity index 94%
rename from Fltk/GmshSocket.h
rename to Common/GmshSocket.h
index bfd22b28fa484abc6bd784b80cd6fc254841de55..4aa46ad38956cc673246e299309c819ba4bce071 100644
--- a/Fltk/GmshSocket.h
+++ b/Common/GmshSocket.h
@@ -242,39 +242,16 @@ class GmshClient : public GmshSocket {
 #endif
     SendString(CLIENT_START, tmp);
   }
-  void Stop()
-  {
-    SendString(CLIENT_STOP, "Goodbye!");
-  }
-  void Info(const char *str)
-  {
-    SendString(CLIENT_INFO, str);
-  }
-  void Warning(const char *str)
-  {
-    SendString(CLIENT_WARNING, str);
-  }
-  void Error(const char *str)
-  {
-    SendString(CLIENT_ERROR, str);
-  }
-  void Progress(const char *str)
-  {
-    SendString(CLIENT_PROGRESS, str);
-  }
-  void View(const char *str) 
-  {
-    // deprecated: use MergeFile(str) instead
-    SendString(CLIENT_MERGE_FILE, str);
-  }
-  void MergeFile(const char *str)
-  {
-    SendString(CLIENT_MERGE_FILE, str);
-  }
-  void ParseString(const char *str)
-  {
-    SendString(CLIENT_PARSE_STRING, str);
-  }
+  void Stop(){ SendString(CLIENT_STOP, "Goodbye!"); }
+  void Info(const char *str){ SendString(CLIENT_INFO, str); }
+  void Warning(const char *str){ SendString(CLIENT_WARNING, str); }
+  void Error(const char *str){ SendString(CLIENT_ERROR, str); }
+  void Progress(const char *str){ SendString(CLIENT_PROGRESS, str); }
+  // deprecated: use MergeFile instead
+  void View(const char *str){ SendString(CLIENT_MERGE_FILE, str); }
+  void MergeFile(const char *str){ SendString(CLIENT_MERGE_FILE, str); }
+  void ParseString(const char *str){ SendString(CLIENT_PARSE_STRING, str); }
+  void SpeedTest(const char *str){ SendString(CLIENT_SPEED_TEST, str); }
   void Option(int num, const char *str)
   {
     if(num < 1) num = 1;
@@ -289,7 +266,6 @@ class GmshClient : public GmshSocket {
     closesocket(_sock);
 #endif
   }
-
 };
 
 class GmshServer : public GmshSocket{
diff --git a/Common/Makefile b/Common/Makefile
index 4c73102f617f8a61c26922510549a033d0992099..84e555f176bf0fbdcd7c60c1cf920a30a71bf89f 100644
--- a/Common/Makefile
+++ b/Common/Makefile
@@ -19,6 +19,7 @@ SRC = Context.cpp\
       Options.cpp\
       CommandLine.cpp\
       Gmsh.cpp\
+      GmshDaemon.cpp\
       OS.cpp\
       OpenFile.cpp\
       CreateFile.cpp\
@@ -104,8 +105,9 @@ Gmsh.o: Gmsh.cpp GmshDefines.h ../Geo/GModel.h ../Geo/GVertex.h \
   ../Post/ColorTable.h CommandLine.h OS.h ../Numeric/Numeric.h \
   ../Numeric/NumericEmbedded.h ../Mesh/Generator.h ../Mesh/Field.h \
   ../Post/PView.h Context.h ../Geo/CGNSOptions.h \
-  ../Mesh/PartitionOptions.h ../Mesh/Partition.h \
+  ../Mesh/PartitionOptions.h ../Mesh/Partition.h GmshDaemon.h \
   ../Plugin/PluginManager.h
+GmshDaemon.o: GmshDaemon.cpp Message.h GmshSocket.h
 OS.o: OS.cpp Message.h
 OpenFile.o: OpenFile.cpp Message.h ../Geo/Geo.h ../Common/GmshDefines.h \
   ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h \
diff --git a/Fltk/Makefile b/Fltk/Makefile
index 7d13c83248e475032ed850cb08d6df894eb3496d..2305528037a2414a2cc9c19462f17e91ee039cb6 100644
--- a/Fltk/Makefile
+++ b/Fltk/Makefile
@@ -207,9 +207,9 @@ Colorbar_Window.o: Colorbar_Window.cpp ../Common/GmshUI.h GUI.h \
   ../Geo/SPoint3.h ../Common/Context.h ../Geo/CGNSOptions.h \
   ../Mesh/PartitionOptions.h
 Solvers.o: Solvers.cpp ../Common/Message.h ../Common/StringUtils.h \
-  Solvers.h GmshSocket.h ../Common/OpenFile.h ../Common/GmshUI.h GUI.h \
-  Opengl_Window.h Colorbar_Window.h ../Post/ColorTable.h Popup_Button.h \
-  SpherePosition_Widget.h ../Mesh/Field.h ../Post/PView.h \
-  ../Geo/SPoint3.h ../Graphics/Draw.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Common/Context.h ../Geo/CGNSOptions.h \
-  ../Mesh/PartitionOptions.h ../Common/OS.h
+  Solvers.h ../Common/GmshSocket.h ../Common/OpenFile.h \
+  ../Common/GmshUI.h GUI.h Opengl_Window.h Colorbar_Window.h \
+  ../Post/ColorTable.h Popup_Button.h SpherePosition_Widget.h \
+  ../Mesh/Field.h ../Post/PView.h ../Geo/SPoint3.h ../Graphics/Draw.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/Context.h \
+  ../Geo/CGNSOptions.h ../Mesh/PartitionOptions.h ../Common/OS.h