Hi,
We're using RAPI to enable communication between our desktop and PPC application over ActiveSync. One of the requirements on our application is that it must be able
to recover from failure, such as cable removal or similiar. This works fine with WM2003, but WM2005 doesn't appear to be able to recover as easily.
The scenario is simple: open a RAPI stream, remove the USB-cable (while the stream is open) and reopen the stream. With WM2005, it will only be possible to reinitialize if our app is restarted.
When attempting to reconnect after cable-removal, we will _always_ get error 0x80070015 (device not ready). This does not occure on WM2003.
This is roughly what we're doing (note - pseudo code):
-------------------------------------------------------------
bool reinitialized = false, reloaded = false, opened = false;
// Dynamically link against RAPI
rapi_dll = LoadLibrary("rapi.dll");
CeRapiInit = GetProcAddress(...), CeRapiUninit = ...;
while(!opened || !(reinitialized && reloaded))
{
CeRapiInit();
try
{
CeRapiInvoke(bla, bla, bla);
opened = true;
} catch (...)
{
if(!reinitialized)
{
// Try to simply reinitialize rapi
CeRapiUninit();
reinitialized = true;
}
else if(!reloaded)
{
// Reload the DLLs (far fetched)
FreeLibrary(rapi_dll);
LoadLibrary(rapi_dll);
reloaded = true;
}
}
}
-------------------------------------------------------------
Any ideas Has anyone else had problems with this
Thanks in advance,
Nille

ActiveSync, WM2005 and recovery
Rob Grunkemeyer
Nah, doesn't work either. If I kill wcecomm, ActiveSync won't be able to connect to the device at all, actually (I need to restart my computer).
I don't get it. Since it works if I restart my app, it seems reasonable that something is cleaned up when the app exit. But what, I wonder...
Regards,
Nille
Deedhun
In case anyone else has this problem, we ended up implementing the ActiveSync stuff in a separate process that we kill when the connection terminates. Works like a charm ;)
Regards,
Nille
Henk Gijsbert
Hi,
Our app retries into eternity if the connection won't open, so that's not it. I have in fact tried to reconnect an hour or so after
cable removal, with the same result (device not ready).
Regards,
Nille
fripper
aaks