10 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
11 s.connect((HOST, PORT))
14 sbuf = buffer.Buffer(s)
22 sbuf.put_utf8(file_name)
24 file_size = os.path.getsize(file_name)
25 sbuf.put_utf8(str(file_size))
27 with open(file_name, 'rb') as f:
28 sbuf.put_bytes(f.read())
30 elapsed_time += time.time() - t
31 print("send lena ",elapsed_time)
38 sbuf.put_utf8(file_name)
40 file_size = os.path.getsize(file_name)
41 sbuf.put_utf8(str(file_size))
43 with open(file_name, 'rb') as f:
44 sbuf.put_bytes(f.read())
46 elapsed_time += time.time() - t
47 print("send lena ",elapsed_time)