tcpmon.py 文件源码

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

项目:tool 作者: PathDump 项目源码 文件源码
def monitor_retransmit():
    global proc

    with proc.stdout:
        for line in iter (proc.stdout.readline, b''):
            if stop_flag:
                break

            tokens = line.split()
            if len(tokens) < 5 or (tokens[2] == '-:-' and tokens[4] == '-:-') \
                    or tokens[0] == "TIME":
                continue

            key = tokens[1] + ':' + tokens[3] + ':6'

            mon_lock.acquire()
            if key not in mon_flows:
                print "updating mon_flows", key
                mon_flows.update ({key: 1})
            mon_lock.release()

    os.kill (proc.pid, signal.SIGTERM)
    proc.wait() # wait for the subprocess to exit
    proc = None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号