]> AND Private Git Repository - Cipher_code.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
new
authorRaphaël Couturier <raphael.couturier@univ-fcomte.fr>
Sun, 11 Jul 2021 16:46:53 +0000 (18:46 +0200)
committerRaphaël Couturier <raphael.couturier@univ-fcomte.fr>
Sun, 11 Jul 2021 16:46:53 +0000 (18:46 +0200)
measure_energy_iot/client_tcp3.py [new file with mode: 0644]

diff --git a/measure_energy_iot/client_tcp3.py b/measure_energy_iot/client_tcp3.py
new file mode 100644 (file)
index 0000000..98c9047
--- /dev/null
@@ -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')