From 299c935c9d5da5937c712211e4209a4941659b1e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Couturier?= Date: Sun, 11 Jul 2021 18:46:53 +0200 Subject: [PATCH] new --- measure_energy_iot/client_tcp3.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 measure_energy_iot/client_tcp3.py 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') -- 2.39.5