mspocketpc.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to close GPRS connectino immediately

 
Post new topic   Reply to topic    mspocketpc.org Forum Index -> Developer Networking
Author Message
Yang



Joined: 10 Nov 2007
Posts: 1

PostPosted: Fri Nov 09, 2007 11:53 pm    Post subject: how to close GPRS connectino immediately Reply with quote

Hi ,
I try to provide a generic solution to close GPRS connection. Please give me
some help.
1. My application use ConnectionManager to establish GPRS connection. See
the code below:

CONNMGR_CONNECTIONINFO ConnInfo;
ZeroMemory(&ConnInfo, sizeof(ConnInfo));
ConnInfo.cbSize = sizeof(ConnInfo);
ConnInfo.dwParams = CONNMGR_PARAM_GUIDDESTNET;
ConnInfo.bExclusive = FALSE; //my application cannot accept TRUE option
ConnInfo.dwPriority = CONNMGR_PRIORITY_USERBACKGROUND;
ConnInfo.guidDestNet = DestInfo.guid;
ConnInfo.hWnd = TERMINAL->HWnd();
ConnInfo.uMsg = TERMINAL->m_nConnMgrNotificationsMsg;
hResult = ConnMgrEstablishConnection(&ConnInfo, &connection_handle);
if(FAILED(hResult))
{
connection_handle = NULL;
return FALSE;
}
2. Later I try to close the connection by

if (connection_handle != NULL)
{
HRESULT hResult = ConnMgrReleaseConnection(connection_handle, 0);
if (FAILED(hResult))
return FALSE;
connection_handle = NULL;
}

3. The result is : GPRS cannot be disconnected immediately.

4. I tried another solution for closing GPRS immediately, by using
RasEnumConnections and RasHangUp.
But the problem is RasEnumConnections cannot find any connection on some
device like HTC VOX. So this solution failed on some
special device.

5. I tried another solution: use GetInterfaceInfo to get all adapters and
use IpReleaseAddress to close all of them.
Unfortunately, on smart phone 2005, it does not work. (Worked on PPC)

So, could you please help me out of this trouble, how do you do in your
application.

Thanks alot.

Archived from group: microsoft>public>pocketpc>developer>networking
Back to top
View user's profile Send private message
Yaroslav Goncharov



Joined: 15 Aug 2007
Posts: 682

PostPosted: Wed Nov 14, 2007 12:25 am    Post subject: Re: how to close GPRS connectino immediately Reply with quote

On new devices with M/PDP a GRPS connection does not have a corresponding
RAS connection. Therefore, there is no way to force a GPRS connection to go
down. So it becomes an OEM dependent feature.

--
Yaroslav Goncharov
Pocket PC Developer Network coordinator, http://pocketpcdn.com
Spb Software House, http://spbsoftwarehouse.com


"Yang" wrote in message @microsoft.com...
> Hi ,
> I try to provide a generic solution to close GPRS connection. Please give
> me
> some help.
> 1. My application use ConnectionManager to establish GPRS connection. See
> the code below:
>
> CONNMGR_CONNECTIONINFO ConnInfo;
> ZeroMemory(&ConnInfo, sizeof(ConnInfo));
> ConnInfo.cbSize = sizeof(ConnInfo);
> ConnInfo.dwParams = CONNMGR_PARAM_GUIDDESTNET;
> ConnInfo.bExclusive = FALSE; //my application cannot accept TRUE option
> ConnInfo.dwPriority = CONNMGR_PRIORITY_USERBACKGROUND;
> ConnInfo.guidDestNet = DestInfo.guid;
> ConnInfo.hWnd = TERMINAL->HWnd();
> ConnInfo.uMsg = TERMINAL->m_nConnMgrNotificationsMsg;
> hResult = ConnMgrEstablishConnection(&ConnInfo, &connection_handle);
> if(FAILED(hResult))
> {
> connection_handle = NULL;
> return FALSE;
> }
> 2. Later I try to close the connection by
>
> if (connection_handle != NULL)
> {
> HRESULT hResult = ConnMgrReleaseConnection(connection_handle, 0);
> if (FAILED(hResult))
> return FALSE;
> connection_handle = NULL;
> }
>
> 3. The result is : GPRS cannot be disconnected immediately.
>
> 4. I tried another solution for closing GPRS immediately, by using
> RasEnumConnections and RasHangUp.
> But the problem is RasEnumConnections cannot find any connection on some
> device like HTC VOX. So this solution failed on some
> special device.
>
> 5. I tried another solution: use GetInterfaceInfo to get all adapters and
> use IpReleaseAddress to close all of them.
> Unfortunately, on smart phone 2005, it does not work. (Worked on PPC)
>
> So, could you please help me out of this trouble, how do you do in your
> application.
>
> Thanks alot.

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
gprs Qos API on wm 5.0 Hi! I am a developer in an ISV. Is there an accessible API that can help 1. creating many GPRS PDP Contexts 2. setting QoS level to these contexts 3. and using these contexts to send data. ? I'm using WM 5.0 on Qtek 9000. Thanks for replying

GPRS Is there any differences when developing for PCC 2002 and Windows Mobile 2003 when it comes to developing for GPRS apps with .NET CF 2003. I believe i can either use 3rd party software or use the API's for GPRS connection. Im developing for PPC 2002 at pr

gprs can anyone advice me how i can create a gprs connection for my PPC application to send info from a DB when i hit a send button. I am using C# for PPC 2002. I believe i may need to write a wrapper and use the API's. Has anyone done this before, or can some

Connect via GPRS Hi, do any of you have sample codes which help in connect gprs? Thx Regards, JC

GPRS / ConnectionManager I want to communicate with a port on localhost and each time i start a server socket the Connection manager automatically opens a GPRS connection. How can i configure the Connection manager to avoid that ?
Post new topic   Reply to topic    mspocketpc.org Forum Index -> Developer Networking All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group