ngamsServer.py 文件源码

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

项目:ngas 作者: ICRAR 项目源码 文件源码
def is_it_us(self, host, port):
        """
        True if the host/port combination corresponds to an address exposed by
        this server
        """
        if port != self.portNo:
            return False

        our_ip = self.ipAddress
        if our_ip != '0.0.0.0' and our_ip == host:
            return True

        # We are exposed to all interfaces and `host` might be one of them
        # gethostbyname_ex[2] is a list of addresses
        for h in socket.gethostbyname_ex(host)[2]:
            if h in self.all_ip_addresses:
                return True
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号