Skip to content

Ping 'count' param throws error for large values, and is signed. #87

@dabell-cc

Description

@dabell-cc

Describe the bug
The ping() function can't be called with a large value for count. It will throw an error.
Setting count to a negative number does not result in an error (but it should).
Seems the count variable is ended up a signed 16-bit int for some reason.

To Reproduce
Steps to reproduce the behavior:
Large value error:

from pythonping import ping
ping('127.0.0.1', count=100000)
result: struct.error: short format requires (-32768) <= number <= 32767

Accept negative number:

from pythonping import ping
ping('127.0.0.1', count=-10)
result: Round Trip Times min/avg/max is 0/0/0 ms

Expected behavior
Expect to be able to set count to a positive int 0 .. sys.maxsize.
Large ping counts are helpful for long ping-flood tests to check for networking stability.

Expect error when setting count to a negative value.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser [e.g. chrome, safari]: n/a
  • Version [e.g. 22]: python 3.10.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions