27 lines
683 B
C++
27 lines
683 B
C++
|
|
#include <expected>
|
|
#include <iostream>
|
|
#include <format>
|
|
|
|
#include <udpclient.hpp>
|
|
|
|
int main(int argc, char** argv) {
|
|
UDPClient cli;
|
|
std::string message("Hello");
|
|
{
|
|
auto res = cli.Bind("www.gnu.org", 1025);
|
|
if (!res) {
|
|
std::cerr << std::format("Error: {}", res.error()) << std::endl;
|
|
return 1;
|
|
}
|
|
}
|
|
{
|
|
auto res = cli.Send(message);
|
|
if (!res) {
|
|
std::cerr << std::format("Error: {}", res.error()) << std::endl;
|
|
return 1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|