PORTS Forum

Ports and Interfaces => Serial Ports => Topic started by: kp on April 30, 2011, 12:38:58 am

Title: I have virtual ports some may not be connected to anything
Post by: kp on April 30, 2011, 12:38:58 am
I need to try to open the virtual serial ports in vb net code and catch the error to see if anything is there at all.
it works but takes a long time about 15 to 20 seconds per virtual port to get catch error and go to the next one.
Is there a way to make this faster?
thanks in advance
Title: Re: I have virtual ports some may not be connected to anything
Post by: Jan Axelson on April 30, 2011, 08:32:22 am
Did you use the SerialPort.GetPortNames method to get valid port names?

Jan
Title: Re: I have virtual ports some may not be connected to anything
Post by: kp on April 30, 2011, 11:18:16 am
these virtual ports were installed with a "ethernet to serial" so that they will stay somewhere in the computer
even if the devices are not connected.  I want to find all connected (the ethernet to serial)
 devices faster. I have 5 com ports when I  get the serial port names, but nothing has to be there(it still gest the com ports names
 but no ethernet to serial devices). In this case I started my program and found out how long it takes to get all "real" serial ports- ones that have the ethernet to serial device connected at this time. I had no devices connected. it was 15 to 20 seconds each to attemp to serialport.open before Catching the error. I want to make this process faster. Please ask any question.
   
Title: Re: I have virtual ports some may not be connected to anything
Post by: Jan Axelson on May 02, 2011, 10:22:16 am
The ports are present but you can't open them unless something is attached?

What ethernet to serial device are you using?

Jan
Title: Re: I have virtual ports some may not be connected to anything
Post by: kp on May 02, 2011, 11:11:28 am
Moxa, and  Gw212 is another one.  Nothing is connected, no ethernet to serial. and no real com ports.
I am looking for a faster way to find out in code if something is connected.
Thanks
 
Title: Re: I have virtual ports some may not be connected to anything
Post by: Jan Axelson on May 02, 2011, 11:18:51 am
If you're looking for a specific device, one thing that can help is to save the port used last time and try that first.

Jan