diff --git a/Common/Context.h b/Common/Context.h
index e24e7226b086bf34e305d6d5252ffdaf74c50e9b..ee9feeefa5a5c6fdce4503fd702f33f9109f6146 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -55,6 +55,8 @@ struct contextGeometryOptions {
   int matchGeomAndMesh;
 };
 
+
+
 class CTX {
  private:
   static CTX *_instance;
@@ -212,6 +214,7 @@ class CTX {
   // solver options 
   struct{
     int plugins, listen;
+    double timeout;
     std::string socketName;
   }solver;
   // print options 
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 74ef995e9ba15e2f5931e455821a664b8124d426..36e2fc450fb25d7f78b3dfc72180e0a3acd2e109 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -1341,6 +1341,9 @@ StringXNumber SolverOptions_Number[] = {
   { F|O, "PopupMessages4" , opt_solver_popup_messages4 , 1. ,
     "Automatically display messages produced by solver 4" },
 
+  { F|O, "Timeout" , opt_solver_timeout , 5. ,
+    "Time (in seconds) before closing the socket if no connection is happening." },
+
   { 0, 0 , 0 , 0. , 0 }
 } ;
 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index d15291eea2242450e8e4d9ed9f842846f0297eea..6e12f5ce68a7e85634cf38372b5f2f6550717048 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -6241,6 +6241,18 @@ double opt_solver_listen(OPT_ARGS_NUM)
   return CTX::instance()->solver.listen;
 }
 
+double opt_solver_timeout(OPT_ARGS_NUM)
+{
+  if(action & GMSH_SET)
+    CTX::instance()->solver.timeout = val;
+#if defined(HAVE_FLTK)
+  if(FlGui::available() && (action & GMSH_GUI))
+    FlGui::instance()->options->solver.value[0]->value(CTX::instance()->solver.timeout);
+#endif
+  return CTX::instance()->solver.timeout;
+}
+
+
 double opt_solver_plugins(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
diff --git a/Common/Options.h b/Common/Options.h
index e1ccad3b0ccb3b5d02a1fa6bd3df25c5e90d4272..bb487f59a6615ff6a389510c75f062fb4c42eec8 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -584,6 +584,7 @@ double opt_mesh_partition_metis_refine_algorithm(OPT_ARGS_NUM);
 double opt_mesh_partition_by_extrusion(OPT_ARGS_NUM);
 double opt_mesh_clip(OPT_ARGS_NUM);
 double opt_solver_listen(OPT_ARGS_NUM);
+double opt_solver_timeout(OPT_ARGS_NUM);
 double opt_solver_plugins(OPT_ARGS_NUM);
 double opt_solver_client_server(OPT_ARGS_NUM);
 double opt_solver_client_server0(OPT_ARGS_NUM);
diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp
index 296bc96cc3be592b570d8eb537e1d9b829df7433..3a15257df369b65062652bf5a1f5736d540e1c20 100644
--- a/Fltk/optionWindow.cpp
+++ b/Fltk/optionWindow.cpp
@@ -495,6 +495,7 @@ static void solver_options_ok_cb(Fl_Widget *w, void *data)
     ConnectionManager::get(-1)->run("");
 
   opt_solver_socket_name(0, GMSH_SET, o->solver.input[0]->value());
+  opt_solver_timeout(0, GMSH_SET, o->solver.value[0]->value());
 
   if(CTX::instance()->fastRedraw)
     CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0;
@@ -2445,8 +2446,13 @@ optionWindow::optionWindow(int deltaFontSize)
         solver.input[0]->align(FL_ALIGN_RIGHT);
         solver.input[0]->callback(solver_options_ok_cb);
 
+        solver.value[0] = new Fl_Value_Input
+          (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Timeout (s)");
+        solver.value[0]->align(FL_ALIGN_RIGHT);
+        solver.value[0]->callback(solver_options_ok_cb);
+
         solver.butt[0] = new Fl_Check_Button
-          (L + 2 * WB, 2 * WB + 2 * BH, BW, BH, 
+          (L + 2 * WB, 2 * WB + 3 * BH, BW, BH, 
            "Always listen to incoming connection requests");
         solver.butt[0]->type(FL_TOGGLE_BUTTON);
         solver.butt[0]->callback(solver_options_ok_cb);
diff --git a/Fltk/solverWindow.cpp b/Fltk/solverWindow.cpp
index ce132c8178954a67c87cb39bc4a4b5e5d0563f1d..028129c4f3c1e723f6da804593812d7bd1c65955 100644
--- a/Fltk/solverWindow.cpp
+++ b/Fltk/solverWindow.cpp
@@ -125,7 +125,7 @@ void ConnectionManager::run(std::string args)
   
   int sock;
   try{
-    sock = server->Start(command.c_str(), sockname.c_str(), 5.);
+    sock = server->Start(command.c_str(), sockname.c_str(), CTX::instance()->solver.timeout);
   }
   catch(const char *err){
     Msg::Error("%s (on socket '%s')", err, sockname.c_str());