我试图多次更改该函数,但不断出现相同的错误

问题描述 投票:0回答:1

任何人都可以提供帮助!

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)
python pycharm
1个回答
1
投票

您正在以完全相同的方式使用sendtosend,而docs for socket interface清楚地表明它们采用不同的参数。

[send仅将要发送的字节作为参数。

© www.soinside.com 2019 - 2024. All rights reserved.