Stop listening to Comm Port
Dear All,
is there anyway to stop listening to a comm port after 2 seconds? coz sometimes after i send command from my computer to my device, the device dint reply and my programe keep listening to the comm port. Is there any way to stop that?
Here is my code for your reference, pls give me some tips on this ...
Dim port As New IO.Ports.SerialPort
With port
.BaudRate = 115200
.DataBits = 8
.Parity = 0
.StopBits = "1"
.PortName = "COM3"
End With
port.Open()
port.WriteLine(tbCmd.Text)
strtest = port.ReadLine() 'how can i stop listening if no reply?
port.Close()
response.write(strtest)
Best Regards
life_s Ng
|