poorconn.delay_before_sending_upon_acceptance¶
-
poorconn.
delay_before_sending_upon_acceptance
(s, t, length=1024)¶ For every socket object returned by
s.accept()
, Chop the content (bytes
insocket.socket.send()
andsocket.socket.sendall()
) to be sent inlength
bytes and delayt
seconds before sending every time. Parameters mean the same asdelay_before_sending()
.This function achieves the results by patching the connection sockets’ member methods
send()
andsendall()
. Theirsendfile()
methods are not patched due to their inconsistent behavior across operating systems.- Returns
A
DelayBeforeSendingUponAcceptanceController
object that controls the patched socket object.- Parameters
- Return type
poorconn._send.DelayBeforeSendingUponAcceptanceController