LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Lost Comport Error

I have an application that connects to a device through the USB port with a USB to Serial Converter.  So the Port is treated as a comport say COM 1.  Everything works good I can open, close, read and write to the Comport.  But the problem comes in if the port gets disconnected and then I try to read from it.  The application locks up or shuts down.  This happens becuase the USB - Serial converter is viewed as a comport and then disapears when it is unplugged.  Is there anything I can do to verify that the comport is still there prior to doing a read/write or what would be the best method to handle this error?
 
Thanks
0 Kudos
Message 1 of 4
(3,301 Views)
I guess at the very least you could always close it and then re-open it.
Check the return value on the re-open to see if it is there.
0 Kudos
Message 2 of 4
(3,280 Views)
I have actually added functionality to verify that it is still there right before I read to the data, but it still happens that it errors out during the read.  I would have expect labWindows to handle it gracefully and just report the error, but it doesn't seem to be doing that.
 
Thanks
0 Kudos
Message 3 of 4
(3,254 Views)
Does it say that the com port is available even if you have the USB-Serial converter disconnected?
Rasheel
0 Kudos
Message 4 of 4
(3,237 Views)