Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9216231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:22:21+00:00 2026-06-18T02:22:21+00:00

I am using POCO C++ lib version 1.4.3 in order to implement an HTTP

  • 0

I am using POCO C++ lib version 1.4.3 in order to implement an HTTP server.
In my use-case there are only two or three clients and I would like to have persistent connections. The clients send data with put requests and the server answers with “HTTP/1.1 201 Created”. The clients open more than one connection. One of the clients could open 20 connections at the same time.

I use the defaults in HTTPServerParams and Poco::Net::ServerSocket (myPort)
and I am using a Poco::ThreadPool (16,48).

The clients sends a http put request and the server answers:

Server:
HTTP/1.1 201 Created
Connection: Close
Date: Thu, 31 Jan 2013 15:21:50 GMT

I saw this result in a PCAP-File with WireShark.

What do I have to do if I don’t want that the server closes the connection after a put request?

— edit and insert source code :

HTTPServer::HTTPServer(uint16_t port, 
                       Poco::Net::HTTPRequestHandlerFactory* handlerFactory):
m_port(port),
m_wasStarted(false)
{
    // HTTPServer takes ownership
Poco::Net::HTTPServerParams*   options = new Poco::Net::HTTPServerParams; 

try
{
    m_threadPool.reset(new Poco::ThreadPool (16,48));

    std::cout << "HTTPServerParams.keepAlive: " 
                  << options->getKeepAlive() << std::endl;

    std::cout << "HTTPServerParams.keepAliveTimeout: " 
                  << options->getKeepAliveTimeout().totalSeconds() << std::endl;

    std::cout << "HTTPServerParams.MaxKeepAliveRequests: " 
                  << options->getMaxKeepAliveRequests()<< std::endl;

    std::cout << "HTTPServerParams.Timeout: " 
                  << options->getTimeout().totalSeconds() << std::endl;

    m_server.reset(new Poco::Net::HTTPServer(handlerFactory,  
                                                 *m_threadPool,
                                                 Poco::Net::ServerSocket(m_port),
                                                                         options)
                                                );
}
catch (const Poco::Exception& e)
{
       //some code ...
}
}

private member from class HTTPServer:

 uint16_t                                m_port;
 bool                                    m_wasStarted;
 std::auto_ptr<Poco::ThreadPool>         m_threadPool;
 std::auto_ptr<Poco::Net::HTTPServer>    m_server;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:22:22+00:00Added an answer on June 18, 2026 at 2:22 am

    Have you tried to use setKeepAlive(true); member function call for the instance of HTTPServerParams class?

    By the way, take a look at setKeepAliveTimeout() member function of the same class.

    Update

    I have found out something interesting: if the sendBuffer() function is used to send the response, then the response contains the Connection: Keep-Alive value; but when the send() function is used, the response contains the Connection: Close value.

    So, the interesting implementation details here: poco/Net/src/HTTPServerResponseImpl.cpp. See implementation of send() and sendBuffer() member functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My team is using Entity Framework 4.3.0 - Code Only with POCO classes as
I am currently writing a multi-threaded C++ server using Poco and am now at
i am making a wrapper for my use for database, using Poco::Database::ODBC the normal
I am writing code first Entity Framework app using POCO. Here is simplified version:
I want to add images to my item using POCO approach. In order for
I'm using EF4.1 POCO. I have two tables [Table(Parent)] public class Parent { public
I'm using c++ and poco libraries. I'm trying to implement a video streaming httpserver.
I am trying to update a POCO using lin2sql. I can also use entity
What is the benefit of using POCO? I don't understand the meaning of Persistence
What does one loose by creating POCO using T4 templates in entity framework 4.0?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.