Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added get_server_output via server_output property in the client #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions iperf3/iperf3.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ def __init__(self,
)

# Set the appropriate C types.
self.lib.iperf_get_test_get_server_output.restype = c_int
self.lib.iperf_get_test_get_server_output.argtypes = (c_void_p,)
self.lib.iperf_set_test_get_server_output.restype = None
self.lib.iperf_set_test_get_server_output.argtypes = (c_void_p,c_int)

self.lib.iperf_client_end.restype = c_int
self.lib.iperf_client_end.argtypes = (c_void_p,)
self.lib.iperf_free_test.restxpe = None
Expand Down Expand Up @@ -453,6 +458,30 @@ def server_hostname(self, hostname):
)
self._server_hostname = hostname

@property
def server_output(self):
"""Toggles direction of test

:rtype: bool
"""
enabled = self.lib.iperf_get_test_get_server_output(self._test)

if enabled:
self._server_output = True
else:
self._server_output = False

return self._server_output

@server_output.setter
def server_output(self, enabled:bool):
if enabled:
self.lib.iperf_set_test_get_server_output(self._test, 1)
else:
self.lib.iperf_set_test_get_server_output(self._test, 0)

self._server_output = enabled

@property
def protocol(self):
"""The iperf3 instance protocol
Expand Down