Define _WIN32_WINNT using a cmake macro; support move semantics for parameter; remove address from HttpServer; add utility for dumping endpoints.
parent
2793357da3
commit
2327edbd5d
@ -0,0 +1,28 @@
|
||||
#include "csoap/utility.h"
|
||||
#include <iostream>
|
||||
|
||||
using tcp = boost::asio::ip::tcp;
|
||||
|
||||
namespace csoap {
|
||||
|
||||
// Print the resolved endpoints.
|
||||
// NOTE: Endpoint is one word, don't use "end point".
|
||||
// TODO
|
||||
void DumpEndpoints(tcp::resolver::results_type& endpoints) {
|
||||
std::cout << "Endpoints: " << endpoints.size() << std::endl;
|
||||
|
||||
tcp::resolver::results_type::iterator it = endpoints.begin();
|
||||
for (; it != endpoints.end(); ++it) {
|
||||
std::cout << " - " << it->endpoint();
|
||||
|
||||
if (it->endpoint().protocol() == tcp::v4()) {
|
||||
std::cout << ", v4";
|
||||
} else if (it->endpoint().protocol() == tcp::v6()) {
|
||||
std::cout << ", v6";
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace csoap
|
@ -0,0 +1,14 @@
|
||||
#ifndef CSOAP_UTILITY_H_
|
||||
#define CSOAP_UTILITY_H_
|
||||
|
||||
#include "boost/asio/ip/tcp.hpp"
|
||||
|
||||
namespace csoap {
|
||||
|
||||
// Print the resolved endpoints.
|
||||
// NOTE: Endpoint is one word, don't use "end point".
|
||||
void DumpEndpoints(boost::asio::ip::tcp::resolver::results_type& endpoints);
|
||||
|
||||
} // namespace csoap
|
||||
|
||||
#endif // CSOAP_UTILITY_H_
|
Loading…
Reference in New Issue