-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path57Client.py
More file actions
34 lines (32 loc) · 864 Bytes
/
57Client.py
File metadata and controls
34 lines (32 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import socket # Import socket module
import time
import sys
i = 0
j = 0
fp = open('57log1.txt', 'a')
s = socket.socket() # Create a socket object # Get local machine name
port = 60000 # Reserve a port for your service.
s.bind(('10.100.0.6', port))
try:
s.connect(('10.100.0.5', port))
except (socket.error):
s.close()
execfile('57client.py')
s.send("Server 6: Hello server 5!")
f = open('received_file', 'wb')
fp.write('Start: ')
fp.write(str(int(time.time() * 1000)))
fp.write('\n')
print ('file 1 opened')
while True:
data = s.recv(4096)
if not data:
break
f.write(data)
f.close()
fp.write('End: ')
fp.write(str(int(time.time() * 1000)))
fp.write('\n')
print ('Successfully got file 1')
s.close()
print ('Connection to server5 closed')