Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Asio, An invalid argument was supplied.
From: Igor R (boost.lists_at_[hidden])
Date: 2008-11-23 14:49:24


Hi,

The lines of code you posted seem to be ok, so the problem is somewhere in
the code you haven't posted here. Ensure that your io_service is initialized
*before* you pass it to the other asio objects, and that the socket is
initialized before you pass it to the acceptor.
Here is an example of how you should use the acceptor:
http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/reference/basic_socket_acceptor/async_accept/overload1.html

2008/11/23 stefys <stefys_at_[hidden]>

> Hello. I am trying to write a simple server, and I am using an
> asynchronous acceptor to get clients:
> acceptor.async_accept(crtclient->getSocket(),
> boost::bind(&Server::gotClient, this, boost::asio::placeholders::error));
> As soon as this is executed, my Server::gotClient gets called with
> ec.message()="An invalid argument was supplied."
> <...>
> What could be wrong? Am I constructing socket incorrectly with
> socket_(ioserv)? Because if I construct it with socket_(ioserv,
> boost::asio::ip::tcp::v4()), I get the error "Already open" in
> ec.message(), rather than "An invalid argument was supplied".
>
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net