|
Boost Users : |
From: Jonathan Biggar (jon_at_[hidden])
Date: 2008-08-07 15:24:09
Jean-Sebastien Stoezel wrote:
> Hi,
>
> thanks for the quick answer. By port number and ip address of an
> acceptor" I mean the address and the port of the ip interface the
> acceptor is listening on.
> In most of the case I've worked on, I used the specify the port I
> wanted to listen on, though for this special case, I do not want the
> acceptor to specify a port number.
>
> Then when I do:
>
> boost::asio::ip::tcp::acceptor acceptor(m_IoService);
>
> when I call
>
> boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint();
>
> I get an exception as follow:
> "The file handle supplied is not valid"
>
> I need to know the ip address and the port number fo the acceptor
> before calling the accept method.
>
> Any thoughts?
Try this:
boost:;asio::ip:tcp:;acceptor acceptor(m_IOService);
acceptor.listen();
boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint();
I pulled this from code I have that works. You probably forgot to call
listen() first.
-- Jon Biggar Floorboard Software jon_at_[hidden] jon_at_[hidden]
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