4#include <cosmos/net/ListenSocket.hxx> 
    5#include <cosmos/net/TCPOptions.hxx> 
    6#include <cosmos/net/TCPConnection.hxx> 
    7#include <cosmos/net/traits.hxx> 
   22template <SocketFamily FAMILY>
 
   23class COSMOS_API TCPListenSocketT :
 
   27        using IPAddress = 
typename FamilyTraits<FAMILY>::Address;
 
   28        using Connection = TCPConnectionT<FAMILY>;
 
   29        static inline constexpr auto TYPE = SocketType::STREAM;
 
   33        explicit TCPListenSocketT(
const SocketFlags flags = SocketFlags{SocketFlag::CLOEXEC}) :
 
   34                        ListenSocket{FAMILY, TYPE, flags} {
 
   38                return typename FamilyTraits<FAMILY>::Options{m_fd};
 
   41        auto ipOptions()
 const {
 
   42                return typename FamilyTraits<FAMILY>::Options{m_fd};
 
   46                return TCPOptions{m_fd};
 
   49        auto tcpOptions()
 const {
 
   50                return TCPOptions{m_fd};
 
   55                Socket::getSockName(addr);
 
 
   60        void bind(
const IPAddress &addr) {
 
   61                return Socket::bind(addr);
 
   64        TCPConnectionT<FAMILY> accept(IPAddress *addr = 
nullptr) {
 
   65                auto fd = Socket::accept(addr);
 
   66                return TCPConnectionT<FAMILY>{fd};
 
   70using TCP4ListenSocket = TCPListenSocketT<SocketFamily::INET>;
 
   71using TCP6ListenSocket = TCPListenSocketT<SocketFamily::INET6>;
 
void getSockName(IPAddress &addr)
Returns the current address that the socket is bound to, if any.