Why doesnt ctrl-c during recvfrom raise keyboardexcpetion

J

Jeff

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/pcapy.html). 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/369n4I81.html
socket_no_hang -- http://rafb.net/p/DCa4cV71.html

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,592
Members
45,103
Latest member
VinaykumarnNevatia
Top