Is it possible to get all open or cached gprs connections on windows mobile and programmatic force them to close?
是否有可能在Windows Mobile上获得所有打开或缓存的gprs连接并且程序化强制它们关闭?
Ive been looking at connection manager api but cant seem to find methods I to do this.
我一直在寻找连接管理器api,但似乎无法找到我这样做的方法。
Regards
Tony
1 个解决方案
#1
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).
可以通过调用ConnMgrReleaseConnection通知Connection Manager您不再使用该连接,但这不会强制关闭连接。它基于注册表(HKEY_LOCAL_MACHINE \ Comm \ ConnMgr \ Planner \ Settings)中定义的生命周期缓存以及Release请求中传递的任何信息而关闭。 (顺便说一句,这些API包装在SDF中的OpenNETCF ConnectionManager对象中)。
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.
强制关闭连接的唯一方法是使用RAS枚举所有设备连接,找到您所关注的连接并关闭它。请注意,如果您这样做,ConnectionManager不知道它已被关闭,因此下次尝试使用该连接时会感到不安。通常情况下,它会在内部出现错误,并尝试再次打开一个新连接,一切都很好,但是YMMV。
#1
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).
可以通过调用ConnMgrReleaseConnection通知Connection Manager您不再使用该连接,但这不会强制关闭连接。它基于注册表(HKEY_LOCAL_MACHINE \ Comm \ ConnMgr \ Planner \ Settings)中定义的生命周期缓存以及Release请求中传递的任何信息而关闭。 (顺便说一句,这些API包装在SDF中的OpenNETCF ConnectionManager对象中)。
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.
强制关闭连接的唯一方法是使用RAS枚举所有设备连接,找到您所关注的连接并关闭它。请注意,如果您这样做,ConnectionManager不知道它已被关闭,因此下次尝试使用该连接时会感到不安。通常情况下,它会在内部出现错误,并尝试再次打开一个新连接,一切都很好,但是YMMV。