Listing 1

(a)
dti::sockets::tcp_client_socket s(endpoint("abc.def.com", 123));
std::string buf;
while (s.recv(buf) >= 0)
    std::cout << "Received: " << buf << std::endl;

(b)
dti::sockets::tcp_listener tl(123);
dti::sockets::tcp_socket s = tl.accept();
s.send("Hello, client!");
s.send("How are you?");