Restarting a Network Connection Tutorial

This section describes the steps used to start a network connection that was stopped due to contention.

Introduction

A low priority connection is terminated when a contention issue occurs and the incoming connection has a higher priority. The low priority connection can be restarted when the higher priority connection is complete. For example, if an always-on Internet connection is terminated to enable the user to send an MMS, the Internet connection is restarted when the message is sent.

Introduction

  1. To terminate the high priority connection on of the following occurs:

    1. The Connection Provider (CPR) receives a TStopNormal message to terminate the process.

    2. The connection remains idle and is automatically terminated.

  2. The PDP Tier Manager does the following:

    1. Indicates to the PDP Meta-Connection Provider (MCPR) of the low priority connection that it can restore the connection.

    2. The PDP MCPR sends an availability notification to the CConnection of the low priority connection.

  3. CConnection of the low priority connection receives the availability notification and uses RConnection::Start(TConnPrefList) to establish the connection.

Restoring a connection

Use the following code to ensure a stopped connection is restored when the higher priority connection has completed.



    TConnPrefList* prefs = TConnPrefList::NewL();
    CleanupStack::PushL(prefs);
    TConnAPPref* APPref = TConnAPPref::NewL(iSnapNumber);
    CleanupStack::PushL(APPref);
    TConnAutoStartPref* autoPref = TConnAutoStartPref::NewL();
    CleanupStack::PushL(autoPref);
    prefs->AppendL(APPref);
    prefs->AppendL(autoPref);

    error = iConnection->Start(*prefs);  //Synchronous start. 
    // For asynchronous variant iConnection->Start(*iPrefs,  iStatus), you need to     // store “prefs” as a class member and delete them in RunL .

    delete APPref;
    delete autoPref;
    prefs->Remove(0);
    prefs->Remove(0);
    delete prefs;