我正在尝试实现握手功能。我正在发送SYN数据包和服务器响应通过ACK包。为了获得服务器响应,我使用了recvfrom函数,即挂起。这是我的密码。
import socket, sys
from struct import *
import codecs
def checksum(msg):
s = 0
for i in range(0, len(msg), 2):
w = ord(msg[i]) + (ord(msg[i+1]) << 8 )
s = s + w
s = (s>>16) + (s & 0