Ruben J=F6nsson ha scritto: > For example: The PC software is talking to a virtual serial port that is = > connected to a USB device. When the PC software has opened the port it ne= ver = > expects the port to go away, which is reasonable considering that a stand= ard = > serial port can't be unplugged. However, when the USB device is unplugged = > (perhaps by accident) really weird things can happen with the PC software= . I = > have not been able to reliably catch any exceptions caused by this and mo= st of = > the time the PC software just hangs. Sometimes I even have had to restart= the = > computer (XP) before I can get the communication up and running again. In theory, a WM_DEVICECHANGE message (in Windows) should alert you of = what is going on. I say in theory since I'm more or less aware of the = subtle details in that :) I used mostly HID Generic devices: in them, the Handles usually become = no longer valid, both Reads and Writes usually Fails, and so do = semaphores and Waits... so you can more or less recover. -- = Ciao, Dario -- Cyberdyne -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist