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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:55:20+00:00 2026-05-15T06:55:20+00:00

Man… thought using ASIO in Boost was going to be easy and intuitive. :P

  • 0

Man… thought using ASIO in Boost was going to be easy and intuitive. 😛

I am starting to get it finally but I am having some trouble. Here’s a snippet.
I am having several compiler errors on the async_accept line. What am I doing wrong? 😛

I’ve based my code off of this page:
http://www.boost.org/doc/libs/1_43_0/doc/html/boost_asio/tutorial/tutdaytime3/src.html

Errors:

Error 1 error C2780: ‘void
boost::asio::basic_socket_acceptor::async_accept(boost::asio::basic_socket
&,boost::asio::ip::basic_endpoint
&,AcceptHandler)’ : expects 3
arguments – 2
provided e:\schoolcode\senior
project\cplusplusport\cplusplusport\alexsocket.cpp 36

Error 2 error C2784: ‘void
boost::asio::basic_socket_acceptor::async_accept(boost::asio::basic_socket
&,AcceptHandler)’ : could not deduce
template argument for
‘boost::asio::basic_socket
&’ from ‘boost::asio::ip::tcp::socket
*’ e:\schoolcode\senior project\cplusplusport\cplusplusport\alexsocket.cpp 36

bool TestSocket::StartListening(int port)
{
    bool didStart = false;

    if (!this->listening)
    {
        //try to listen
        acceptor = new tcp::acceptor(this->myService, tcp::endpoint(tcp::v4(), port));
        didStart = true; //probably change?
        tcp::socket* tempNewSocket = new tcp::socket(this->myService);
        acceptor->async_accept(tempNewSocket, boost::bind(&TestSocket::NewConnection, this, tempNewSocket, boost::asio::placeholders::error) );
    }
    else //already started!
        return false;

    this->listening = didStart;
    return didStart;
}

void TestSocket::NewConnection(tcp::socket* s, const boost::system::error_code& error)
{

}
  • 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-05-15T06:55:21+00:00Added an answer on May 15, 2026 at 6:55 am

    async_accept expects a reference to the socket, not a pointer, so try

    acceptor->async_accept(*tempNewSocket, ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Man, I'm having a rough day. I have a ASP.NET 2.0 application with AJAX
I checked the man pages and documentation but they only discuss the command line
I'm using Cluebat-man's LabVIEW-C++ array interoperability class, and I'm getting an error extracting the
By man I find printf(%*d, width, num); and printf(%2$*1$d, width, num); are equivalent. But
I have a poor man's replication setup that I can't do anything about. Some
Looking at the man page for fopen I cannot get a definite answer to
Man being developer is great but days like this make you want to become
Man, WTH is going on with this stuff. You know what that line actually
The Mythical Man-Month is now classic, but the Surgical Team methodology is still interesting.
I run man gcc | grep -L I get Usage: grep [OPTION]... PATTERN [FILE]...

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.