private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { if (_device == null) { // Retrieve the device list CaptureDeviceList devices = CaptureDeviceList.Instance; // If no devices were found print an error if (devices.Count < 1) { return; } List <WinPcapDevice> captureDevices = devices.Where(d => d is WinPcapDevice).Cast <WinPcapDevice>().ToList(); var interfacePicker = new InterfacePicker(captureDevices); interfacePicker.ShowDialog(); if (!interfacePicker.PressedYes) { return; } if (interfacePicker.SelectedDevice == null) { return; } // Print out the available network devices _device = interfacePicker.SelectedDevice; // Register our handler function to the // 'packet arrival' event _device.OnPacketArrival += device_OnPacketArrival; } UpdateStatus("Recording from " + _device.Interface.FriendlyName); // Open the device for capturing var readTimeoutMilliseconds = 1000; _device.Open(DeviceMode.Promiscuous, readTimeoutMilliseconds); // Start the capturing process _device.StartCapture(); }