Introduction
The c++ (cpp) ios_deque example is extracted from the most popular open source projects, you can refer to the following example for usage.
Programming language: C++ (Cpp)
Class/type: ios_deque
Example#1File:
proxy-server.cppProject:
huydx/custom_proxy
server::server(const ios_deque& io_services, int port, std::string interface_address)
: io_services_(io_services),
endpoint_(interface_address.empty()?
(ba::ip::tcp::endpoint(ba::ip::tcp::v4(), port)): // INADDR_ANY for v4 (in6addr_any if the fix to v6)
ba::ip::tcp::endpoint(ba::ip::address().from_string(interface_address), port) ), // specified ip address
acceptor_(*io_services.front(), endpoint_) // By default set option to reuse the address (i.e. SO_REUSEADDR)
{
std::cout << endpoint_.address().to_string() << ":" << endpoint_.port() << std::endl;
start_accept();
}
Example#2File:
test-mcmt.cppProject:
AFialkovskiy/boost-asio-examples
/**
* Initialize all needed data
*
* @param io_service reference to io_service
* @param port port to listen on, by default - 10001
*/
server(const ios_deque& io_services, int port=10001)
: io_services_(io_services),
acceptor_(*io_services.front(),
ba::ip::tcp::endpoint(ba::ip::tcp::v4(), port)) {
start_accept();
}