×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    16

    simple RConnection question

    Maybe this is a more general question about R* classes but here goes.

    When I start my application upon user input I establish a connection to an access point. e.g.

    Code:
    class MyClass
    {
    private:
       /* other members */
       RSocketServ iSocketServer;
       RConnection iConnection;
    };
    
    MyClass:StartMyAppL()
    {
       User::LeaveIfError(iSocketServer.Connect());
       User::LeaveIfError(iConnection.Open(iSocketServer));
       /* other stuff */
    }
    Later in another part of the program I need to do a hostname lookup (among other things). This is done in another class where I do not have access to the RConnection in MyClass. (keeping in mind I have not disconnected the earlier connection to the AP)

    Code:
    class OtherClass
    {
    private:
        RSocketServ iSocketServer;
        RConnection iConnection;
        RHostResolver iResolver;
    };
    
    void
    OtherClass::LookupL()
    {
        User::LeaveIfError(iSocketServer.Connect());
        User::LeaveIfError(iConnection.Open(iSocketServer));
        User::LeaveIfErorr(iResolver.Open(iSocketServer, KAfInet, KProtocolInetTcp, iConnection));
    }
    When LookupL() is executed the third statement leaves because iResolver.Open returns -18 KErrNotReady. Is this like "Device already in use"?

    Do I have to make available my original RConnection to the LookupL() function and use it instead of opening another? If I choose not to provide the iConnection to the iResolver.Open() call the code works fine but I am prompted for access point selection again (which I don't want). So what am I doing wrong? What is the correct way to use RConnection?

    Thanks

  2. #2
    Regular Contributor
    Join Date
    May 2006
    Posts
    79

    Re: simple RConnection question

    hi rtrnokia,

    In your class u tried to open a resource which is holded by another class , so its returning the object doesn't not ready to use that resource that means the resource already used by your previous class.Still its holding that resource.

    No need to implement 2 classes, you can use the one class to make the connection. you can start multiple connections using RConnection.Start() method.

    Use these codes to hide the access point prompt,
    //Define preferences for connection
    TCommDbConnPref prefs;
    prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    TUint32 iIapId; //Get the proper APN from the CommDb.
    prefs.SetIapId(iIapId);


    Cheers,
    Karthikeyan.B

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    16

    Re: simple RConnection question

    Ahh, I see I thought I would just get another handle to the already open IAP. I also notice I did not show the Start() call I was making in my original post.

    So to get what I expect it will really be necessary to pass the existing RConnection which was already Start()ed for use by my second class.

    Thanks I'll give it a try.

Similar Threads

  1. Simple division/casting question
    By s4028469 in forum Symbian
    Replies: 4
    Last Post: 2007-09-03, 03:34
  2. a simple question on sound files
    By girish sharma in forum Symbian Media (Closed)
    Replies: 4
    Last Post: 2005-02-02, 08:13
  3. simple question: setClip()
    By doomer999 in forum Mobile Java General
    Replies: 2
    Last Post: 2003-05-23, 02:53
  4. SIMPLE Question: synchronise 8310 with Outlook -> how?
    By doltijn1 in forum General Development Questions
    Replies: 0
    Last Post: 2003-05-07, 11:17
  5. Very simple question:
    By marcgom in forum Mobile Java General
    Replies: 1
    Last Post: 2003-02-26, 10:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •