poorconn.delay_before_sending_once

poorconn.delay_before_sending_once(s, t)

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

This function achieves the results by patching s’s member methods send() and sendall(). s’s sendfile() method is not patched due to its inconsistent behavior across operating systems.

Parameters
  • s (socket.socket) – The socket.socket object whose sending methods are to be delayed for once and once only.

  • t (float) – Number of seconds to delay.

Returns

A DelayBeforeSendingOnceController object that controls the patched socket object.

Return type

DelayBeforeSendingOnceController