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 8376503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:26:46+00:00 2026-06-09T15:26:46+00:00

I am using boost asio to develop a tcp server process which listens for

  • 0

I am using boost asio to develop a tcp server process which listens for client connections. The clients are expected to send partial packets. Server process can’t process the packet until it receives the entire packet from the client (header,data and footer).

In order to handle partial packets, server process needs to push the packets( or partial packets) from each client connection to a queue. Server would maintain a queue per client connection.

Now my question is how to get a socket file descriptor when using boost asio. I am planning to use the integer value from socket file descriptor and create a std::map container that handles queue per client connection.

std::map< int, std::deque< std::string >

If retrieving socket file descriptor is not feasible what could be the alternatives for optimal performance. Do I need to use

std::map< tcp::socket *,std::deque< std::string> > ?

Thanks in advance.

  • 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-09T15:26:47+00:00Added an answer on June 9, 2026 at 3:26 pm

    When you call the various receive functions, pass in a pointer (or shared pointer) to the structure associated with that connection. There’s no need for a map from the socket descriptor because you never need to touch the socket descriptor.

    Like this:

    boost::asio::async_read(socket, boost::asio::buffer(buf),
        boost::bind(&MyConnection::doRead, this, boost::asio::placeholders::error));
    
    
    void MyConnection::doRead(const boost::system::error_code& error)
    {
     // Here, we are in the object associated with this connection
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a TCP client using boost::asio . I want to send an array
I'm developing a tcp client using boost::asio to process incoming text, that ends with
i have a c++ server which is using boost::asio to do read/write operations -
I'm using the Boost::asio to implement a client/server applicaion. The client code below is
I'm using Boost asio to send and receive framed TCP messages. Does anyone know
I wrote a small tcp client using boost::asio, providing the following function: typedef boost::function<void(const
Is I am looking at writing a multithreaded tcp server using boost ASIO. I
There is a client/server application written using Boost's ASIO (Boost v.1.48) + OpenSSL (v.1.0.0d).
I have a very simple server/client performance test using boost::asio on Windows and it
I am trying to Create a simple Tcp Server in C++ using Boost ASio

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.