#include <xtd/collections/generic/list>
#include <xtd/io/stream_reader>
#include <xtd/net/sockets/udp_client>
#include <xtd/net/ip_end_point>
#include <xtd/threading/thread>
#include <xtd/console>
auto main() -> int {
auto terminate_app = false;
while (!terminate_app) {
auto buffer = udp.receive(incoming_end_point);
if (buffer.size() && buffer[0] != 0xFF)
console::write_line(string(buffer.begin(), buffer.end()));
}
}};
auto udp =
udp_client {address_family::inter_network_v6};
auto counter = 0;
while (!terminate_app) {
auto str = string::format("counter={}", ++counter);
thread::sleep(50_ms);
}
}};
server.start();
client.start();
console::read_key();
terminate_app = true;
server.join();
client.join();
}
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.h:71
virtual size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(xtd::collections::generic::list::...
Definition list.h:364
Represents a network endpoint as an IP address and a port number.
Definition ip_end_point.h:23
Provides User Datagram Protocol (UDP) network services.
Definition udp_client.h:45
Creates and controls a thread, sets its priority, and gets its status.
Definition thread.h:43
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.h:15
The xtd::net::sockets namespace provides a managed implementation of the Berkeley Sockets interface f...
Definition address_family.h:16
The xtd::net namespace provides a simple programming interface for many of the protocols used on netw...
Definition cookie_exception.h:11
The xtd::threading namespace provides classes and interfaces that enable multithreaded programming....
Definition abandoned_mutex_exception.h:11
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10