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 in socket.socket.send() and socket.socket.sendall()) to be sent in length bytes and delay t seconds before sending every time. Parameters mean the same as delay_before_sending().

This function achieves the results by patching the connection sockets’ member methods send() and sendall(). Their sendfile() methods are not patched due to their inconsistent behavior across operating systems.

Returns

A DelayBeforeSendingUponAcceptanceController object that controls the patched socket object.

Parameters
  • s (socket.socket) –

  • t (float) –

  • length (int) –

Return type

poorconn._send.DelayBeforeSendingUponAcceptanceController