poorconn

The main package of Poorconn. It contains functions that simulate Poor Network Conditions.

Simulation Functions

close_upon_acceptance(s)

Shutdown and close the connection socket upon accepting.

delay_before_sending(s, t[, length])

Chop the content (bytes in socket.socket.send() and socket.socket.sendall()) to be sent in length bytes and delay t seconds before sending every time.

delay_before_sending_once(s, t)

Delay t seconds before sending for once (first time only).

delay_before_sending_upon_acceptance(s, t[, …])

For every socket object returned by s.accept(), Chop the content (bytes in socket.socket.send() and socket.socket.sendall()) to be sent in length bytes and delay t seconds before sending every time.

delay_before_sending_upon_acceptance_once(s, t)

Delay t seconds before sending for all sockets returned by s.accept(), for once (first time only).

Other Functions

make_socket_patchable(s[, funcs])

Make a socket patchable: Create a PatchableSocket object if any functions in funcs are not patchable.

Classes

DelayBeforeSendingController(t, length)

Controller for delay_before_sending().

DelayBeforeSendingOnceController(t)

Controller for delay_before_sending_once().

DelayBeforeSendingUponAcceptanceController(t, …)

Controller for delay_before_sending_upon_acceptance().

DelayBeforeSendingUponAcceptanceOnceController(t)

Controller for delay_before_sending_upon_acceptance_once().

PatchableSocket([family, type, proto, fileno])

A class that allows some socket.socket functions to be patchable and thus can be wrapped.