|
|
Classification: |
C++ |
Category: |
Networking |
Created: |
09/20/2002 |
Modified: |
10/07/2002 |
Number: |
FAQ-0823 |
Platform: |
Symbian OS v6.0, Symbian OS v6.1 |
|
Question: My app needs to use a particular ISP and should not keep putting up a request dialog. How can I achieve these things?
Answer: In general you should avoid overriding user preferences but, if you need to for special reasons, you can achieve this by doing
the following two things.
- First configure a Comms Db override object with the dial-up settings you want.
- Then pass it as an argument to RNetDial::StartDialOut(...) (in v6.0) or RGenericAgent::StartOutgoing(...) (in v6.1).
The following code indicates how this can be achieved in v6.0:
TUint32 isp; // = the address of the isp you want to connect to TRequestStatus iStatus; RNetDial iNetDial; ... CStoreableOverrideSettings* overrides=CStoreableOverrideSettings::NewL(CStoreableOverrideSettings::EParamListPartial, EDatabaseTypeISP);CleanupStack::PushL(overrides); User::LeaveIfError(overrides->SetIntOverride(TPtrC(DIAL_OUT_ISP), KNullDesC,isp)); User::LeaveIfError(overrides->SetIntOverride(TPtrC(ASK_USER_BEFORE_DIAL), KNullDesC, (TInt) EFalse)); iNetDial.StartDialOut(*overrides, iStatus); // v6.0 only User::WaitForRequest(iStatus); CleanupStack::PopAndDestroy(); // overrides
For v6.1, rather than using an RNetDial, you would declare an RGenericAgent:
RGenericAgent iNetAgent;
and the connection would be established as follows:
User::LeaveIfError(iNetAgent.Open()); iNetAgent.StartOutgoing(*overrides, iStatus); User::WaitForRequest(iStatus); iNetAgent.Close(); CleanupStack::PopAndDestroy(); // overrides Notes
1. Normally the above code would be embedded in an active object rather than using User::WaitForRequest(). 2. You will need separate code to deal with EDatabaseTypeIAP.
|
|
|