Earlier I wrote about a problem with libpcap on OS X. This is the call in the code that breaks the wireless connection.
/* ask pcap to find a valid device for use to sniff on */ dev = pcap_lookupdev(errbuf);
but replace it with this (en1 is my wireless interface)
dev="en1";
and then use dev in other libpcap functions and it works fine.