Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
Why doesnt ctrl-c during recvfrom raise keyboardexcpetion
Jeff
2/21/2008 3:27:00 AM
Hi,
Fairly new to python, messing with some socket and pcap sniffing and
have come across the following issue while trying to do a pcap_loop
(via pcapy
http://oss.coresecurity.com/projects/...
). I believe
i recall seeing similar stuff using other pcap libs with python in the
past (such as pylibpcap)
in a nutshell, blocking on a read using socket.recvfrom(buf), which
strace shows me is sitting in recvfrom(2) allows ctrl-c to be raised
as keyboardInt, which i can catch with try/except or just let it go
all the way up and kill the script.
But calling pcapy.loop(5,cbk) which also, via strace, is sitting in
recvfrom(2) - via libpcap itself - cannot be interrupted with sigint,
strace shows the signal, but nothing raises.
Here are some snippets that show the issue and code
pcapy_hangs --
http://rafb.net/p/369...
socket_no_hang --
http://rafb.net/p/DCa...
Any light that someone can shed on this would be greatly appreciated,
or what is a usual workaround (is this a symptom of calling recvfrom
via a compiled lib like pcapy somehow set SIG_IGN on SIGINT ?)
tia,
-jeff
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Why doesnt ctrl-c during recvfrom raise keyboardexcpetion
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password