#include #include #include #include #include int main(int argc, char** argv) { UDPClient cli; std::string message("Hello"); const std::string hostname("www.gnu.org"); Resolver resolver; auto resolveRes = resolver.Resolve(hostname); if (!resolveRes) { auto msg = std::format("Cannot resolve hostname {}: {}", hostname, resolveRes.error()); std::cerr << std::format("Error: {}", msg) << std::endl; return 1; } auto raddr = resolveRes.value(); auto address = raddr.GetAddress(); auto bindRes = cli.Bind(address, 1025); if (!bindRes) { std::cerr << std::format("Error: {}", bindRes.error()) << std::endl; return 1; } auto sendRes = cli.Send(message); if (!sendRes) { std::cerr << std::format("Error: {}", sendRes.error()) << std::endl; return 1; } return 0; }