views:

155

answers:

1

I need to enumerate and close individual GPRS connections on a Windows Mobile device.

I've tried the RAS API as suggested by this answer, however it doesn't work on all devices. RasEnumConnections on an HTC device does list GPRS sessions, but on a Samsung it doesn't.

The Samsung has a GUI app with this functionality - it makes a lot of use of ossvcs.dll but the functions it uses are only exported by ordinal, so I have no idea what they are!

I have also looked at Connection Manager API but it doesn't let you enumerate existing connections.

Any more ideas? Is there an API I've missed?

A: 

Enumerating and closing connections is intentionally difficult. The general idea is that an application should not be forcibly terminating connections that do not belong to it because it very un-neighborly. It assumes that apps using the connection are prepared to have that connection torn out from under them, and that's not a valid assumption.

Even if you could enumerate the connections through connection manager, you still can't close them. You can only mark a connection as no longer in use by your application, so if the Connection Manager sees that no one is using it and the timeout for the connection expires, then it may close it.

RAS was a workaround/hack to get at those connections, but it's been deprecated so OEMs don't have to use RAS for managing connections, and it sounds like Samsung isn't using it. Instead they chose to have their own proprietary implementation.

The only way at that implementation would be through their own proprietary API, and it doesn't look like they publish it, so you'd have to reverse engineer it. Even then it's going to be specific to their device, and brittle as it may change across versions.

My advice is to rethink the need to shut down all connections on the device.

ctacke