c# - SerialPort.Open() takes very long time to execute -
i'm having trouble when i'm trying use serialport.open() function. opens in 5 seconds , takes several minutes.
this code:
public void invokeserialportdetectedevent(string s) { serialportdetectevent.invoke(this, s); // invoked funktion called porthandeler_serialportdetectevent() } void porthandeler_serialportdetectevent(object sender, string name) { openserialport(name); adddongletodevicelist(); } private void openserialport(string name) { if (serialport1.isopen) { return; } serialport1.portname = name; try { serialport1.open(); if (serialport1.isopen) { console.write("open serialport: " + name); } } catch (exception e) { console.write(e.message); console.write(e.stacktrace); } }
such long delays can induced device driver port. nowadays 1 emulates serial port , signals on usb or bluetooth. or sure, dongle meant enforce license agreement, hint in question.
you'll need turn manufacturer of device support. low odds you'll hear back, kind of mishap reason mistrust quality of device. throw away , 1 different manufacturer stop wasting time.
Comments
Post a Comment