![](/uploads/1/2/7/6/127652701/757878212.jpg)
You should use the SerialPort.GetPortNames method to return an array of all available serial ports. This is faster and more reliable than opening each possible port in sequence.If you download EnhancedSerialPort.dll from my homepage (it is free), you will find an additional method.GetPortDescriptions.
This adds provides a list of the descriptions, which might be helpful, in addition to the port names.When you send a command and expect a response, it is more productive to use a simple loop (with a timeout) to poll the SerialPort object for the expected response. If the response is not received within the timeout period, usually less than a coupleof hundred mS, you can close the port and move on to the next one in the list. This requires less code than using the DataReceived event, and it is easier to debug.DickDick Grier. Author of Visual Basic Programmer's Guide to Serial Communications 4. See www.hardandsoftware.net. Before adding the handler for DataReceived you could set the ReadTimeout property and do a send / receive. If the IO times out then the test would indicate that the port is not the one you want.Something like thisFor Each p As String In IO.Ports.SerialPort.GetPortNamesDim sp As New IO.Ports.SerialPort(p, 9600, IO.Ports.Parity.None, 8, IO.Ports.StopBits.One)sp.ReadTimeout = 1000sp.Opensp.WriteLine('FOO')Trysp.ReadLine'good port hereStopCatch ex As TimeoutExceptionStopEnd Trysp.CloseNextMicrosoft® Community Contributor 2011. Mac format usb for linux.
Before adding the handler for DataReceived you could set the ReadTimeout property and do a send / receive. If the IO times out then the test would indicate that the port is not the one you want.Something like thisFor Each p As String In IO.Ports.SerialPort.GetPortNamesDim sp As New IO.Ports.SerialPort(p, 9600, IO.Ports.Parity.None, 8, IO.Ports.StopBits.One)sp.ReadTimeout = 1000sp.Opensp.WriteLine('FOO')Trysp.ReadLine'good port hereStopCatch ex As TimeoutExceptionStopEnd Trysp.CloseNextMicrosoft® Community Contributor 2011. You should use the SerialPort.GetPortNames method to return an array of all available serial ports. This is faster and more reliable than opening each possible port in sequence.If you download EnhancedSerialPort.dll from my homepage (it is free), you will find an additional method.GetPortDescriptions. This adds provides a list of the descriptions, which might be helpful, in addition to the port names.When you send a command and expect a response, it is more productive to use a simple loop (with a timeout) to poll the SerialPort object for the expected response.
Rpg maker mv bind pictures to map. How to enumerate available COM ports on a. End If If lCount = 0 Then EnumSerialPorts = Split. Tagged vb6 serial-port or ask your.
![Enumerate Serial Ports Vb6 Split Command Enumerate Serial Ports Vb6 Split Command](http://assets.devx.com/articlefigs/15419.jpg)
If the response is not received within the timeout period, usually less than a coupleof hundred mS, you can close the port and move on to the next one in the list. This requires less code than using the DataReceived event, and it is easier to debug.DickDick Grier. Author of Visual Basic Programmer's Guide to Serial Communications 4. See www.hardandsoftware.net.
![](/uploads/1/2/7/6/127652701/757878212.jpg)