c# - Using Pcap.Net with thread throws 'System.NullReferenceException' -
i have method:
public void rc() { try{ using (packetcommunicator communicator = device1.open(65536, packetdeviceopenattributes.promiscuous, 1000)) { richtextbox1.appendtext("listening on " + device1.description + "... \r\n"); // start capture communicator.receivepackets(0, packethandler); communicator.break(); } } catch (exception ex) { throw ex; } }
and when start programm, , call method via
thread othread = new thread(new threadstart(r.rc)); othread.start(); thread.sleep(1); othread.join();
it throws @ end of line "using (packetcommunicator...."
an unhandled exception of type 'system.nullreferenceexception' occurred in ...
additional information: object reference not set instance of object.
addition info: when don't have method "rc" , thread, , code in constructor, didn't have issue line .
Comments
Post a Comment