Boost logo

Boost Users :

From: Igor R (boost.lists_at_[hidden])
Date: 2008-08-07 13:13:28


What do you mean by "port number and ip address of an acceptor"? If
you want to know the address of your local "endpoint", then you can
get it:

boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint();

then get its address and port:
endpoint.address();
endpoint.port();

But if you want to get the address of your peer, then you can get it
from accept() or async_accept() -- please see their descriptions.

P.S. IMHO, asio has *very* clear, readable, and useful manual, and I'm
sure you could find there aswers to most of your questions:
http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio.html

2008/8/7, Jean-Sebastien Stoezel <js.stoezel_at_[hidden]>:
> Hi,
>
> How to get the port number and ip address of an acceptor?
>
> I tried this:
>
> boost::asio::ip::tcp::acceptor acceptor(m_IoService);
> boost::asio::ip::tcp::acceptor myEndPoint(m_IoService);
>
> acceptor.get_option(myEndPoint);
>
> But this does not compile, Iget a couple of errors in
> win_iocp_socket_service.hpp like this one:
>
> Error 8 error C2039: 'level' : is not a member of
> 'boost::asio::basic_socket_acceptor<Protocol>'
>


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