TSS000031
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 网络
说明:
建立Internet连接的最好的方法是使用Internet Connection Initiator API.
其头文件为Intconninit.h,链接库为Intconninit.lib。
下面是如何使用的示例代码,如果没有默认连接(Preferred Connection),
实际上, 你可以创建一个活动对象(active object)来控制连接的初始化过程.
CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref1;
CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref2;
//--- First preference ----
pref1.iRanking = 1;
pref1.iDirection = ECommDbConnectionDirectionOutgoing;
pref1.iDialogPref = ECommDbDialogPrefDoNotPrompt;
CCommsDbConnectionPrefTableView::TCommDbIapBeare bearer1;
bearer1.iBearerSet = ECommDbBearerGPRS;
bearer1.iIapId = 0x01;
pref1.iBearer = bearer1;
//---Second preference ---
pref2.iRanking = 2;
pref2.iDirection = ECommDbConnectionDirectionOutgoing;
pref2.iDialogPref = ECommDbDialogPrefDoNotPrompt;
CCommsDbConnectionPrefTableView::TCommDbIapBearer bearer2;
bearer2.iBearerSet = ECommDbBearerCSD;
bearer2.iIapId = 0x04;
pref2.iBearer = bearer2;
//---Call Initiator---
TRequestStatus status(KRequestPending);
CIntConnectionInitiator* initConn = CIntConnectionInitiator::NewL();
CleanupStack::PushL(initConn);
initConn->ConnectL(pref1, pref2, status);