19 int main(
int argc,
char** argv) {
20 using namespace libwire;
21 using namespace std::literals::string_view_literals;
23 if (argc != 2 && argc != 3) {
24 std::cerr <<
"Usage: echo-client <ip> [port]\n";
30 port = uint16_t(std::stoi(argv[2]));
38 while (std::cout <<
"> ", std::getline(std::cin, buffer)) {
39 buffer.push_back(
'\n');
43 size_t lf = buffer.find_last_of(
'\n');
44 if (lf != buffer.npos) {
48 std::cout <<
"< " << buffer <<
'\n';
size_t write(const Buffer &, std::error_code &, const endpoint &dest=endpoint::invalid) noexcept
Write contents of buffer to socket.
void associate(endpoint target, std::error_code &ec) noexcept
Associate UDP socket with remote endpoint.
int main(int argc, char **argv)
This file defines free functions for interaction with system resolver.
Buffer & read(size_t bytes_count, Buffer &, std::error_code &, endpoint *source=nullptr) noexcept
Read pending datagram into buffer.
Descriptor wrapper for UDP socket.
This file defines udp::socket type, base class for outgoing UDP communication.
std::vector< address > resolve(ip protocol, const std::string_view &domain, std::error_code &ec) noexcept
Resolve domain name to one or more IP addresses of 'protocol' version.
constexpr size_t max_msg_size