petro4213 has asked for the wisdom of the Perl Monks concerning the following question:
I'm using Win32::SerialPort to connect to a virtual COM device. When I (accidentally) disconnect the device, such that the virtual COM port does no longer exist, any attempt to read or write to it will hang my Perl program forever, regardless of any timeouts set.
Is there a way to either avoid this hangup or to detect whether the COM port still exists and the serial port is still connected to it?
Just checking for the COM port to exist (e.g. using a lookup in the Registry) doesn't solve the problem, as accesses then also hang the program, if the COM port was only temporarily disconnected, in which case the COM port exists (again), but the Win32::SerialPort object is no longer connected to it properly.
Any help greatly appreciated!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::SerialPort - How do I detect if device is still connected?
by cavac (Prior) on Jul 04, 2024 at 08:55 UTC | |
by petro4213 (Acolyte) on Jul 04, 2024 at 12:48 UTC | |
by cavac (Prior) on Jul 04, 2024 at 14:09 UTC | |
by NERDVANA (Priest) on Jul 04, 2024 at 17:44 UTC | |
|
Re: Win32::SerialPort - How do I detect if device is still connected?
by The_Dj (Scribe) on Jul 09, 2024 at 03:24 UTC | |
by Corion (Patriarch) on Jul 09, 2024 at 07:24 UTC |