none
GPRS Issue on Windows CE Based device RRS feed

  • Question

  • Hi,

    We are working on an application that is designed to periodically download data updates from the server. The app works on Symbol MC9000 series devices which are customised PocketPC based devices and run Windows CE and Compact Framework 1.

    What we are experiencing is that we start to get Timeout Exception when calling WebServices over GPRS about 48 hours after initial connection. This continues until we reset the device. We are using OpenNetCF classes to call webservices and I think it's pretty standard code there.

    Our initial thought was that if we disconnect and reconnect GPRS connection that would perhaps "free up some of the resources" but this doesn't really seem to work.

    Has anybody around here encounter this or a similar problem. Also, if someone with some expertise in this area comment of where the problem might actually be.

    Many Thanks
    Hamid Shahid
    Friday, October 20, 2006 9:07 AM

Answers

  • Is there a reason that you are using opennetcf classes? Is there some functionality you require that is not in the compact framework? NETCF does have support for web services and the underlying http object automatically connects/disconnects from gprs networks when it is used.

    Thanks,

    Sandy

    Tuesday, October 31, 2006 5:32 PM

All replies

  • Following are the connection and disconnection function we are using


            public void Connect()
            {
                try
                {
                    Log.Info( "Connect()" );
                    TimeSpan ts = DateTime.Now.Subtract( _lastFailedConnectAttempt );

                    // Make sure there are at least 2 minutes between failed attempts to
                    // connect in the background, or when processing initialisation.
                    if( IsAutoProcessingOnForegroundThread )
                        Log.Info( "AutoProcessingOnForegroundThread" );
                    else
                        Log.Info( "NOT AutoProcessingOnForegroundThread" );

                    if( (!IsAutoProcessingOnForegroundThread && Helpers.AmIGUIThread() ) || ts.TotalMinutes > 2 )
                    {
                        if (OpenNETCF.Net.ConnectionStatus.Connected != _connectionManager.Status)
                        {
                            Log.Info( "Attempting to connect" );
                            if (    OpenNETCF.Net.ConnectionStatus.ConnectionCancelled == _connectionManager.Status
                                ||    OpenNETCF.Net.ConnectionStatus.ConnectionFailed == _connectionManager.Status
                                ||    OpenNETCF.Net.ConnectionStatus.WaitingDisconnection == _connectionManager.Status)
                            {
                                Log.Info( "Forcing disconnect" );
                                _connectionManager.Disconnect(); // Called directly to avoid resetting the last failed connect time.
                            }

                            Log.Info( "Calling connect" );
                            _connectionManager.Connect(true, OpenNETCF.Net.ConnectionMode.Asynchronous);

                            Log.Info( "Waiting for known status" );
                            while (_connectionManager.Status == OpenNETCF.Net.ConnectionStatus.Unknown)
                            {
                                Thread.Sleep(50);
                            }
                            
                            Log.Info( "Waiting for connection" );
                            while(_connectionManager.Status == OpenNETCF.Net.ConnectionStatus.WaitingConnection )
                                Thread.Sleep(500);
                            
                            if( _connectionManager.Status != OpenNETCF.Net.ConnectionStatus.Connected )
                            {
                                Log.Info( "Failed to connect" );
                                _lastFailedConnectAttempt = DateTime.Now;
                            }
                            else
                            {
                                Log.Info( "Connect succeeded" );
                                _lastFailedConnectAttempt = DateTime.MinValue;
                            }
                        }
                        else
                            Log.Info( "Already connected" );
                    }
                    else
                    {
                        Log.Info( "Not attempting to connect" );
                    }
                }
                catch(Exception ex)
                {
                    Log.Error( "Connect threw exception", ex );
                    _lastFailedConnectAttempt = DateTime.Now;
                    throw new Exception("A problem occurred whilst trying to establish a connection. Please retry. ",ex    )  ;
                }
            }


            public void Disconnect(bool waitTillDisconnected)
            {
                _lastFailedConnectAttempt = DateTime.MinValue;
                Log.Info( "Attempting to disconnect" );
                _connectionManager.Disconnect();
                if (waitTillDisconnected)
                {
                    Log.Info( "Waiting for disconnect state" );
                    while (_connectionManager.Status != OpenNETCF.Net.ConnectionStatus.Disconnected)
                    {
                        Thread.Sleep(50);
                    }
                    Log.Info( "Connection Status is now disconnected" );
                }
                Log.Info( "Disconnected successfully" );
                
            }


    We are using OpenNetCF's connectionManager class to connect and disconnect. I have also tried using RAS API's directly that that didn't work either.

    Please, any suggestions in this regard would be really appreciated.
    Friday, October 20, 2006 10:56 AM
  • Is there a reason that you are using opennetcf classes? Is there some functionality you require that is not in the compact framework? NETCF does have support for web services and the underlying http object automatically connects/disconnects from gprs networks when it is used.

    Thanks,

    Sandy

    Tuesday, October 31, 2006 5:32 PM
  • Sandeep,

    Thanks for answering.
    We have a requirement to let the user Enable or Disable GPRS using a button on the device.
    We have tried using both OpenNetCF's connectionManager and RAS APIs (RASHangup and RASDial) and we get the same issue.

    The thing that concerns me is that this bit of functionality works fine for about 2 days and then all of the sudden it stops being able to connect to GPRS. We raised this issue with our Device vendor and he came back with the following answer

    "This is probably because of an already known failure inside Microsoft Connection Manager. This means that it can lock up after a period of time. It has been addressed by Microsoft and is in their next AKU update"

    but the operating system he's mentioning is Windows Mobile 5 while we are working on Windows CE. I wonder if there is a similar problem in Windows CE as well?


    Many Thanks
    Hamid Shahid
    Friday, November 3, 2006 10:21 AM