iperf3.py 文件源码

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

项目:iperf3-python 作者: thiezn 项目源码 文件源码
def __init__(self,
                 role,
                 verbose=True,
                 lib_name='libiperf.so.0'):
        """Initialise the iperf shared library

        :param role: 'c' = client; 's' = server
        :param verbose: enable verbose output
        :param lib_name: The libiperf name providing the API to iperf3
        """
        # TODO use find_library to find the best library
        try:
            self.lib = cdll.LoadLibrary(lib_name)
        except OSError:
            raise OSError('Could not find shared library {0}. Is iperf3 installed?'.format(lib_name))

        # The test C struct iperf_test
        self._test = self._new()
        self.defaults()

        # stdout/strerr redirection variables
        self._stdout_fd = os.dup(1)
        self._stderr_fd = os.dup(2)
        self._pipe_out, self._pipe_in = os.pipe()  # no need for pipe write

        # Generic test settings
        self.role = role
        self.json_output = True
        self.verbose = verbose
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号