def receivePictureFile(client): filetodown = open("pic2.jpg", "wb") while True: data = client.recv(1024) if data == b"DONE": break filetodown.write(data) filetodown.close() ## hàm nhận ảnh ở client def takeScreenShot(connection): myscreenshot = pyautogui.screenshot() myscreenshot.save("pic1.jpg") filetosend = open("pic1.jpg", "rb") data = filetosend.read(1024) while data: connection.send(data) data = filetosend.read(1024) filetosend.close() #"Send DONE." time.sleep(0.5) connection.send(b"DONE") #to break while os.remove("pic1.jpg") #delete picture in sever #hàm gửi ảnh ở sever