How to use the pythonping.executor.Communicator function in pythonping

To help you get started, we’ve selected a few pythonping examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alessandromaggio / pythonping / test / test_executor.py View on Github external
def test_increase_seq(self):
        """Verifies Communicator can increase sequence number correctly"""
        self.assertEqual(executor.Communicator.increase_seq(1), 2, 'Increasing sequence number 1 did not return 2')
        self.assertEqual(executor.Communicator.increase_seq(100), 101, 'Increasing sequence number 1 did not return 2')
        self.assertEqual(executor.Communicator.increase_seq(0xFFFF), 1,
                         'Not returned to 1 when exceeding sequence number maximum length')
        self.assertEqual(executor.Communicator.increase_seq(0xFFFE), 0xFFFF,
                         'Increasing sequence number 0xFFFE did not return 0xFFFF')
github alessandromaggio / pythonping / pythonping / __init__.py View on Github external
:type out: stream
    :return: List with the result of each ping
    :rtype: executor.ResponseList"""
    provider = payload_provider.Repeat(b'', 0)
    if size and size > 0:
        if not payload:
            payload = random_text(size)
        provider = payload_provider.Repeat(payload, count)
    elif sweep_start and sweep_end and sweep_end >= sweep_start:
        if not payload:
            payload = random_text(sweep_start)
        provider = payload_provider.Sweep(payload, sweep_start, sweep_end)
    options = ()
    if df:
        options = network.Socket.DONT_FRAGMENT
    comm = executor.Communicator(target, provider, timeout, socket_options=options, verbose=verbose, output=out)
    comm.run()
    return comm.responses