qmsk/net/transport/endpoint.py
changeset 44 01ac7755b15a
parent 38 f0fc793a3754
equal deleted inserted replaced
43:9fdef438e3a2 44:01ac7755b15a
    91         if not socktype :
    91         if not socktype :
    92             raise ValueError("Socket type unknown")
    92             raise ValueError("Socket type unknown")
    93 
    93 
    94         return [AddrInfo(0, self.family, socktype, protocol, self._sockaddr, self.canonical)]
    94         return [AddrInfo(0, self.family, socktype, protocol, self._sockaddr, self.canonical)]
    95 
    95 
    96 class InetAddr (Address) :
    96 class InetAddress (Address) :
    97     """
    97     """
    98         An AF_INET/AF_INET6 address, with addr and port.
    98         An AF_INET/AF_INET6 address, with addr and port.
    99     """
    99     """
   100     
   100     
   101     @property
   101     @property
   104 
   104 
   105     @property
   105     @property
   106     def port (self) :
   106     def port (self) :
   107         return self._sockaddr.port
   107         return self._sockaddr.port
   108 
   108 
   109 class IPv4Addr (InetAddr) :
   109 class IPv4Addr (InetAddress) :
   110     """
   110     """
   111         A fixed AF_INET address and port
   111         A fixed AF_INET address and port
   112     """
   112     """
   113 
   113 
   114     def __init__ (self, addr, port) :
   114     def __init__ (self, addr, port) :
   115         super(IPv4Addr, self).__init__(af_inet.sockaddr_in(addr, port))
   115         super(IPv4Addr, self).__init__(af_inet.sockaddr_in(addr, port))
   116 
   116 
   117 class IPv6Addr (InetAddr) :
   117 class IPv6Addr (InetAddress) :
   118     """
   118     """
   119         A fixed AF_INET6 address and port
   119         A fixed AF_INET6 address and port
   120     """
   120     """
   121 
   121 
   122     def __init__ (self, addr, port) :
   122     def __init__ (self, addr, port) :