io - Serial port com3 doesn't exist c# -


i have usb device plugged in serial port on com3. use open port:

string[] ports = serialport.getportnames(); foreach (string portname in ports) {      try      {           var port = new serialport(portname, 256000);           port.open();      }      catch(exception ex)      {           console.writeline(ex.message);      } } 

i io exception here "port com3 not exist". use vs2012 + win7x64pro. tried reboot windows , worked fine, 1 time. days ago run project on vs2012 + win8 , great. worked great, no exceptions found. found great amount of similar questions there not solution problem. more information: usb device use bluegiga bled112 driver version "ble-1.1.1-71". explain me please , doing wrong.

bluetooth creates phantom virtual serial ports can't opened. in worse scenario, paired, , driver spends minute looking not-present bluetooth accessory before failing open.

other serial devices may not respond being opened no reason (opening change voltages on several serial pins).

solution: never open serial ports returned getportnames in loop. instead open 1 device attached to. (you can know checking device descriptor strings, or in worst case, asking user of listed ports right one)

perhaps you're trying use bluetooth radio? in case you're using wrong approach. serial port associated bluetooth use when pair device identifies spp (serial port profile). not manipulating radio. use sockets api. see bluetooth programming windows sockets. c#, you'll want use one of third-party libraries wraps stuff.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -