_process.py 文件源码

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

项目:jubakit 作者: jubatus 项目源码 文件源码
def _get_ports_in_use(cls):
    """
    Returns a set of ports currently used on localhost.
    """
    try:
      return set([x.laddr[1] for x in psutil.net_connections(kind='inet4')])
    except psutil.AccessDenied:
      # On some platforms (such as OS X), root privilege is required to get used ports.
      # In that case we avoid port confliction to the best of our knowledge.
      _logger.info('ports in use cannot be obtained on this platform; ports will be assigned sequentially')
      return set()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号