我正在尝试在python中使用struct模块来打包位。目前,我不断收到错误消息,指出无法将该参数转换为int类型。我传递的参数是一个整数文字(特别是0)。
这是我收到的回溯。
Traceback (most recent call last):
File "client.py", line 130, in <module>
main()
File "client.py", line 66, in main
s.connect((destination,port))
File "file.py", line 116, in connect
0,0,0,0)
struct.error: cannot convert argument to integer
以下是相关代码:
first_fin = self.header_struct.pack(self.version, FIN, self.opt_ptr,
self.protocol, self.header_len,self.checksum,
self.source_port,self.dest_port,
0,0,0,0)