Actually there is a special type ip::tcp::socketfor tcp sockets. As for generic::stream_protocol::socket, this is a universal type of stream socket that accepts the socket protocol and its family at run time, so you can use it for both types that you need:
generic::stream_protocol::socket ipc(io_, generic::stream_protocol(AF_UNIX, 0));
generic::stream_protocol::socket tcp(io_, generic::stream_protocol(AF_INET, IPPROTO_TCP));
source
share