force use ipv4 instead of ipv6

in some network configs, ipv6 isnt configured properly, but ipv4 is. forced usage of ipv4 instead of ipv6
This commit is contained in:
rintyuu 2024-11-18 16:59:36 -08:00
parent 8fd0272eba
commit f563932981

View file

@ -12,7 +12,8 @@ void queryNTPServer(const std::string& server) {
asio::io_context io_context; asio::io_context io_context;
asio::ip::udp::resolver resolver(io_context); asio::ip::udp::resolver resolver(io_context);
asio::ip::udp::endpoint endpoint = *resolver.resolve(server, std::to_string(NTP_PORT)).begin(); asio::ip::udp::resolver::query query(asio::ip::udp::v4(), server, std::to_string(NTP_PORT));
asio::ip::udp::endpoint endpoint = *resolver.resolve(query).begin();
asio::ip::udp::socket socket(io_context); asio::ip::udp::socket socket(io_context);
socket.open(asio::ip::udp::v4()); socket.open(asio::ip::udp::v4());