這段代碼直接把數據packet_base作為ip的載荷了,怎麼才能是packet_base作為tcp的載荷呢?謝謝
sock = socket.socket(socket.AF_INET,
socket.SOCK_RAW,
socket.IPPROTO_TCP)
sock.sendto(packet_base, 0, (IP_PACKET_IN, 12321))
sock.close()
把你的代碼修改成如下就是TCP啦:
sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)