BackupGGCode / pypcap

simplified object-oriented Python extension module for libpcap
Other
0 stars 1 forks source link

The pcap.pcap() will blocked when it run in thread with twisted and wxPython #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
import threading
import pcap

import wx
from twisted.internet import wxreactor
wxreactor.install()
from twisted.internet import reactor

def run():
    import pcap
    p = pcap.pcap() # we blocked here!
    print 'Created pcap'
    for ts, package in p:
        print ts, len(package)

reactor.callInThread(run)
reactor.run()

This piece of code reproduce the problem. 

Original issue reported on code.google.com by Borns...@gmail.com on 28 May 2009 at 5:34

GoogleCodeExporter commented 9 years ago
I believe this blocks because you don't call p.setnonblock(1) before trying to 
read packets. This can probably be closed.

Original comment by otherwis...@gmail.com on 1 Dec 2011 at 10:08