From: Raphaƫl Couturier Date: Mon, 12 Jul 2021 09:45:41 +0000 (+0200) Subject: new X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/commitdiff_plain/036cc9445b8a15c282c095c6631215fec2a68520 new --- diff --git a/measure_energy_iot/buffer.py b/measure_energy_iot/buffer.py new file mode 100644 index 0000000..373a777 --- /dev/null +++ b/measure_energy_iot/buffer.py @@ -0,0 +1,42 @@ +class Buffer: + def __init__(self,s): + '''Buffer a pre-created socket. + ''' + self.sock = s + self.buffer = b'' + + def get_bytes(self,n): + '''Read exactly n bytes from the buffered socket. + Return remaining buffer if