Forum Index > Application is locked for a long timeout period when using Comm.get_PortOpen() if attached device is not ready. Any chance to change that?

By: Volker Posted on: Nov 18 2010 at 05:15:07 PM
Hi,
I'm using several devices attached via a bluetooth serial bridge. Such connections may fail e.g. when a device is out of range. After such a unfriendly disconnection one has to close the com port and open it again to reset the connection. My problem is the following: When doing such a reconnect trial the system can't know if the device is available again. So the ionly way to detect this is to try a port open command. If it fails then the device is not available again (e.g. still out of range). The method works well but the problem is a very long timeout period until the system returns the negative return code (error) when trying to open an unavailable device. During this period the application gets stuck while wiating for the response. Is there any way to define a much shorter timeout period for comm32 open commands?
Any other idea how to handle the porblem?

Volker.

By: Support Posted on: Nov 19 2010 at 12:01:43 AM
I don't think we can influence the timeout period - that's dictated by Windows just the same as when you try to open a network resource that is unavailable.

Version 3.2t includes a new function .getPortStatus.

I suppose it depends on the nature of the problem because this function still relies on Windows to know that a device is not available but it may well give you the information you need BEFORE you waste time trying to open a port that isn't going to be available anyway.

The old .DeviceExist( ) property would simply return true or false but not give any additional information. The new .getPortStatus functions returns the common states such as exists, doesn't exists, exits-but-busy etc but if it's not one of those then it returns a numerical value the same as the windows system error codes which you can resolve to network errors, timeouts and a mass of other reasons why a port might not be available.


 

Reply - add comment to this topic
You may enter letters, numbers and standard punctuation only. HTML and other scripts/tags will be rejected
  Topic:- Application is locked for a long timeout period when using Comm.get_PortOpen() if attached device is not ready. Any chance to change that?

Your Name


 


Forum scripts and databases - Copyright (c) 2009 - 2012 AxCoL.com