error in receiving data from interfaces through raw sockets

108 Views Asked by At

I have given my program below. Here I want to receive data from simhost interface through raw sockets. Then I want to write it into a buffer, but as soon as select call happens program execution stops and shows keyboard interrupt. What is the problem with my program?

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
0

There are 0 best solutions below