Shows how to use xtd::net::sockets::tcp_client class.
#include <xtd/io/stream_reader>
#include <xtd/net/sockets/tcp_client>
#include <xtd/net/sockets/tcp_listener>
#include <xtd/threading/thread>
#include <xtd/console>
auto main()->int {
auto terminate_app = false;
listener.start();
auto stream = listener.accept_tcp_client().get_stream();
while (!terminate_app)
}};
auto client =
tcp_client {address_family::inter_network_v6};
client.
connect(ip_address::ip_v6_loopback, 9400);
auto stream = client.get_stream();
auto counter = 0;
while (!terminate_app) {
}
}};
server.start();
client.start();
terminate_app = true;
server.join();
client.join();
}