event handling in com port

486 views Asked by At

i wrote a c++ code to communicate with usb gsm modem using com ports. now i want to be informed immediately when the modem is pulled out or disconnected somehow. can i do this by using event handling or any other way? if the answer is yes then I'll be very grateful if someone tell me the way. thanks in advance :).

thanks Arefin

2

There are 2 answers

0
MSalters On

Yes. The USB standard is quite definite about the fact that unplugging of devices is allowed and must be managed by the OS. Since you haven't told us which OS, we can't point you to the precise function. In general, you'd look at the device management functions.

0
Dr. Watson On

If your platform is Win32, there are messages for device removal that you can register for. I'm sure there is something similar in Linux and other large OS.