BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
resolve.cpp
Go to the documentation of this file.
1 #include <fc/asio.hpp>
2 #include <fc/network/ip.hpp>
3 #include <fc/log/logger.hpp>
4 
5 namespace fc
6 {
7  std::vector<fc::ip::endpoint> resolve( const std::string& host, uint16_t port )
8  {
9  auto ep = fc::asio::tcp::resolve( host, std::to_string(uint64_t(port)) );
10  std::vector<fc::ip::endpoint> eps;
11  eps.reserve(ep.size());
12  for( auto itr = ep.begin(); itr != ep.end(); ++itr )
13  {
14  if( itr->address().is_v4() )
15  {
16  eps.push_back( fc::ip::endpoint(itr->address().to_v4().to_ulong(), itr->port()) );
17  }
18  // TODO: add support for v6
19  }
20  return eps;
21  }
22 }
ip.hpp
fc::to_string
std::string to_string(double)
Definition: string.cpp:73
fc
Definition: api.hpp:15
fc::ip::endpoint
Definition: ip.hpp:65
asio.hpp
logger.hpp
fc::resolve
std::vector< fc::ip::endpoint > resolve(const std::string &host, uint16_t port)
Definition: resolve.cpp:7
fc::asio::tcp::resolve
std::vector< endpoint > resolve(const std::string &hostname, const std::string &port)
Definition: asio.cpp:225