//获取本机网络设备
var devices = CaptureDeviceList.Instance;//报红是怎么回事
//IP = ipAddress;
int count = devices.Count;
if (count < 1)
{
Console.WriteLine("No device found on this machine");
return;
}
public void CaptureFlowSend(string IP, int portID, int deviceID)
{
ICaptureDevice device = (ICaptureDevice)CaptureDeviceList.New()[deviceID];//.New()也报红
device.OnPacketArrival += new PacketArrivalEventHandler(device_OnPacketArrivalSend);
int readTimeoutMilliseconds = 1000;
device.Open(DeviceMode.Promiscuous, readTimeoutMilliseconds);
string filter = "src host " + IP + " and src port " + portID;
device.Filter = filter;
device.StartCapture();
ProcInfo.dev.Add(device);
}