pcap_t*pcapDescriptor=pcap_open(source,// name of the device
snapshotLength,// portion of the packet to capture
// 65536 guarantees that the whole packet will be captured on all the link layers
safe_cast<int>(attributes),
readTimeout,// read timeout
auth,// authentication on the remote machine
errbuf);// error buffer
errorBuffer);// error buffer
if(pcapDescriptor==NULL)
{
throwgcnewInvalidOperationException("Unable to open the adapter. "+gcnewString(source)+" is not supported by WinPcap");
// throw gcnew InvalidOperationException("Unable to open the adapter. " + gcnew String(source) + " is not supported by WinPcap. Error: " + MarshalingServices::UnmangedToManagedString(std::string(errbuf)));
}
throwgcnewInvalidOperationException("Unable to open the adapter. Adapter name: "+gcnewString(source)+". WinPcap Error: "+gcnewString(errorBuffer));