The main problem--broad overview:
I am trying to initialize two GPIB power supplies on an ENET-GPIB/100 box. When I start my program without being on the network (necessary for programming in one location and using the program at another location), trying to initialize these devices can take up to 30 seconds each (1 minute) during which my UI is hung. This is what I want to correct. Also: the 'network' is a Windows 2000 self initialized network on a direct connect cable to the ENET-GPIB/100 so network traffic is not the problem.
Some investigation has revealed:
On startup, when I am not connected to the network, the resource name for what I'm trying to access (GPIB0::7::INSTR) does not appear in a VISA Resource Name drop down box. When the resource does not appear, I have long timeout delays, usually around 11 seconds, when trying to open, write or set the timeout value itself. Three of these together (set timeout, open, write) with a bad VISA resource were causing my 30 second delays. After removing the set timeout call, and the VISA Open call (which I didn't know previously was unecessary), I now have 11 second delays when trying to initialize, so about 22 or 23 seconds now total.
There are three timeout values I have used to try and correct this:
1) The general visa timeout value which defaults at 2 seconds (to no avail)
2) The I/O timeout value for the GPIB device itself in MAX (it was worth a try, also to no avail)
3) The VISA Open timeout value (also to no avail)
This appears to be a network connectivity issue because my UI (all threads) stall when this happens. By stall I mean it hangs but not permanently--when the VISA call eventually times out, everything you clicked/typed/did happens all at once
Scenario:
Program starts, no ethernet connection to GPIB-ENET/100 has been established.
Power supply init times out in ~10secs/supply
Ethernet connection established:
Power supplies init correctly
Connection broken (unplugged / loss-of-comm):
Timeouts of 20-40 seconds/supply while entire program is completely stalled (not a good thing)
I have a few questions that might help me resolve this:
There is no delay time in pinging the ENET-GPIB/100 to see if it is available. This tells me if I should even try and talk to it / initialize since it will be of no use if the network is down. This requires an IP address and is doable but it means that I cannot change the ENET-GPIB/100 IP address in MAX at any given point when needed, without also telling my compiled program the new address somewhere in an init file.
Question: Is it possible to determine the IP address of an ethernet device given it's VISA Resource Name?
Since my resource name (GPIB0::7::INSTR) is constant, but not always valid (when I'm unplugged), I tried using VISA Find Resource to determine if it was a valid resource. This also has the same delay problems... ~10-11 seconds at first when initially started not plugged in, no delay (and finds resource) when plugged in, and long delays (up to 90 seconds) after unplugging again... during which point, as I mentioned earlier, my UI is completely stalled and I can't even click the 'STOP' button.
Question: Is there another way besides VISA Find Resource to determine if the resource I want to access is valid?
Any other suggestions on getting rid of this timeout delay would be greatly appreciated.