任何人都可以提供帮助!
Ack = exp_seq_num
clientSocket.sendto(Ack.encode(), (serverName, serverPort)) #Sending the POSITIVE ACK to the server after encoding it.
Ack_checksum = hashlib.md5(Ack.encode('utf-8')).hexdigest()
Ack_checksum = str(Ack_checksum)
clientSocket.send(Ack_checksum.encode(), (serverName, serverPort))
incoming_file.write(incoming_data)
**This is the message error:**
clientSocket.send(Ack_checksum.encode('utf-8'), (serverName, serverPort))
TypeError: an integer is required (got type tuple)
您正在以完全相同的方式使用sendto
和send
,而docs for socket interface清楚地表明它们采用不同的参数。
[send
仅将要发送的字节作为参数。