From: Raphaƫl Couturier Date: Sun, 11 Jul 2021 16:46:53 +0000 (+0200) Subject: new X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/commitdiff_plain/299c935c9d5da5937c712211e4209a4941659b1e?ds=sidebyside new --- diff --git a/measure_energy_iot/client_tcp3.py b/measure_energy_iot/client_tcp3.py new file mode 100644 index 0000000..98c9047 --- /dev/null +++ b/measure_energy_iot/client_tcp3.py @@ -0,0 +1,31 @@ +import socket # Import socket module +import time + +s = socket.socket() # Create a socket object +host = "192.168.0.106" #Ip address that the TCPServer is there +port = 50000 # Reserve a port for your service every new transfer wants a new port or you must wait. + + +t = time.time() +s.connect((host, port)) + +filename="lena2.jpg" +f = open(filename,'rb') +l = f.read(1024) +while (l): + s.send(l) + l = f.read(1024) +f.close() + + +s.close() + + + +elapsed_time = time.time() - t + +print("time pil",elapsed_time) + +print('Successfully get the file') + +print('connection closed')