title: How do I customize the timeout value for a client connection in Oat++?
body: <h2>Timeouts</h2>
  <p>I'm using Oat++ to make a REST API client/server for a Windows application. I'm designing the requests to be small and fast, so I want the timeouts to be quick. It's not catastrophic if it times out, I just don't want the request to block for a long time. &quot;Give up quickly&quot; is my motto for this.</p>
  <h2>ConnectionMonitor</h2>
  <p>I see what looks like the facility for this: <a href="https://github.com/oatpp/oatpp/blob/master/changelog/1.3.0.md#connectionmonitor" rel="nofollow noreferrer">ConnectionMonitor</a>. I attempted to adapt this to my application.</p>
  <pre><code>auto objectMapper = oatpp::parser::json::mapping::ObjectMapper::createShared();
  auto config = oatpp::openssl::Config::createShared();
  auto connectionProvider = oatpp::openssl::client::ConnectionProvider::createShared(config, {server_addr, server_port)});
  auto monitor = std::make_shared&lt;oatpp::network::monitor::ConnectionMonitor&gt;(connectionProvider);
  monitor-&gt;addMetricsChecker(
      std::make_shared&lt;oatpp::network::monitor::ConnectionInactivityChecker&gt;(
      std::chrono::seconds(5),
      std::chrono::seconds(5)
      )
  );
  auto requestExecutor = oatpp::web::client::HttpRequestExecutor::createShared(monitor);
  auto client = MyClient::createShared(requestExecutor, objectMapper);
  </code></pre>
  <p><em>(I'm not using the <code>AppComponents</code> recommendation because in this application, I wanted parameters for the objects normally created in it—e.g. ObjectMapper, Config, ConnectionProvider, HttpRequestExecutor, etc.—to come from the object, not hardcoded defaults.)</em></p>
  <h2>Results</h2>
  <p>When I invoke one of the client API calls, times out right around 21 seconds, which is the same timeout I see when I don't do any of the ConnectionMonitor stuff and just pass <code>connectionProvider</code> to the CTOR for <code>requestExecutor</code>.</p>
  <p>When I monitor network traffic, I can see something being attempted every couple of seconds. Will that thwart the timeout?</p>
  <p><a href="https://i.stack.imgur.com/FNDVG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FNDVG.png" alt="Wireshark capture snippet" /></a></p>
  <p>Without the monitor code, the client works fine, as it does with the code, so long as I don't kill the server or block the connection (to test the timeout).</p>
  <p>What am I doing wrong?</p>
  <p>Is there a way I can diagnose this problem?</p>