connection.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:privcount 作者: privcount 项目源码 文件源码
def address_port(address):
    '''
    Return a string describing port portion of an address
    If there is no port portion, returns None
    '''
    # Looks like an IPv4Address or IPv6Address
    try:
        # ignore type, it's always TCP
        return "{}".format(address.port)
    except AttributeError:
        pass
    # Looks like a HostnameAddress
    # (we don't yet support hostnames in connect and listen)
    try:
        return "{}".format(address.port)
    except AttributeError:
        pass
    # We don't know any other way to get a port
    return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号