我已经在下面给了我的程序。在这里,我想通过原始套接字从simhost接口接收数据。然后我想将它写入缓冲区,但只要选择调用,程序执行就会停止并显示键盘中断。我的程序有什么问题?
import socket
import select
import sys
import time
from socket import socket, AF_PACKET, SOCK_RAW
s = socket(AF_PACKET, SOCK_RAW)
s.bind(("simhost-eth2", 0))
buffer = []
input = [s]
while 1:
inputready, outputready, exceptready = select.select(input, [], [])
for s in inputready:
l, addr = s.recvfrom(1024)
buffer.append(l)
print buffer