views:

844

answers:

1

Hi There, Is it possible to get all open or cached gprs connections on windows mobile and programmatic force them to close?

Ive been looking at connection manager api but cant seem to find methods I to do this.

Regards

Tony

+1  A: 

Connection Manager can be notified that you're no longer using the connection by calling ConnMgrReleaseConnection, but that does not forcibly close the connection. It is closed based on the lifetime caching defined in the registry (HKEY_LOCAL_MACHINE\Comm\ConnMgr\Planner\Settings), as well as any info passed in the Release request. (BTW, these APIs are wrapped in the OpenNETCF ConnectionManager objects in the SDF).

The only way to forcibly close the connection is to use RAS to enumerate all device connections, find the one you're after, and close it. Be aware that if you do this, ConnectionManager doesn't know that it's been closed, so it's going to be upset the next time it tries to use that connection. Typically it will get an error internally and try to open a new connection again and all is well, but YMMV.

ctacke