×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    17

    passing arguments in asyncronous server

    my server was synchronous it was working fine. but now i have made it asynchronus by making these changes
    1. i have set the message slots to 2 ( a i can make two request pending) while creating the session i.e createsession in client.
    2. made one asyncronous function having trequeststatus, i have made the descriptor which i am passing from the client as a member variable of the client.
    3. i m handling the asyncronous request in the server side.

    but the problem is : the descriptor which i am passing in the asyncronous function from client is not getting passed to the
    server side( server is handling async request). in server side i m getting junck value in the descriptor.

  2. #2
    Regular Contributor
    Join Date
    Mar 2008
    Location
    Bangalore, India
    Posts
    68

    Re: passing arguments in asyncronous server

    Which Descriptor you are passing . Can you post some code snippet of client and server side functions
    "Nobody will believe in you unless you believe in yourself."

  3. #3
    Registered User
    Join Date
    Sep 2007
    Posts
    17

    Re: passing arguments in asyncronous server

    i have tried the same thing for an integer but that is also not getting passed to the server.

    EXPORT_C void RCryptoSrv::EncryptL( TInt aVal, TRequestStatus& aStatus )
    {
    iVal = aVal;
    TPckg<TInt> pkcgVal( iVal );
    iTestArgs.Set(0,&pkcgVal );
    SendReceive( EEncryptFile, iTestArgs, aStatus );
    }

  4. #4
    Regular Contributor
    Join Date
    Mar 2008
    Location
    Bangalore, India
    Posts
    68

    Re: passing arguments in asyncronous server

    EXPORT_C void RCryptoSrv::EncryptL( TInt aVal, TRequestStatus& aStatus )
    {
    iVal = aVal;
    //TPckg<TInt> pkcgVal( iVal );
    iTestArgs.Set(0,iVal);
    SendReceive( EEncryptFile, iTestArgs, aStatus );
    }

    Try above code for sending an integer...

    I feel as you are using asynchronous communication the TPckg will be destroyed as go out of function and your 0 argument pointer will be pointing to some junk values.
    "Nobody will believe in you unless you believe in yourself."

  5. #5
    Registered User
    Join Date
    Sep 2007
    Posts
    17

    Re: passing arguments in asyncronous server

    thanks for the reply.
    yes u r saying it correct. when i am packaging the data. it is getting destroyed.
    but if i want to pass some strut then i need to package it.
    some solution for that.

  6. #6
    Regular Contributor
    Join Date
    Mar 2008
    Location
    Bangalore, India
    Posts
    68

    Re: passing arguments in asyncronous server

    make TPckg var as member varible
    TPckg<mystruct> iPkcgVal;

    EXPORT_C void RCryptoSrv::EncryptL( mystruct& aMyStruct, TRequestStatus& aStatus )
    {
    iPkcgVal( aMyStruct);
    iTestArgs.Set(0,&iPkcgVal);
    SendReceive( EEncryptFile, iTestArgs, aStatus );
    }

    Try this
    "Nobody will believe in you unless you believe in yourself."

  7. #7
    Registered User
    Join Date
    Sep 2007
    Posts
    17

    Re: passing arguments in asyncronous server

    thanks for the replies ...
    but lastly i have found the mistake i was making ...
    actually the reason behind this what i found is :
    it is not working in case of asyncronous request coz in async the kernel takes the value from the
    address space of client and directly reading value causes in some descriptor results in junk value i.e
    aMessage.ReadL( 0, des) so take the values in proper pointers rather than using aMessage.ReadL( 0, des )
    coz kernel resolve the address values which are passed from client to server.
    and passing values from the client use member variable not local variables.
    client side:
    typedef RArray<TFileName> RFolderList;
    EXPORT_C void RClient::Fun( RFolderList& aFolderList, TRequestStatus& aStatus )
    {
    iFolderList = aFolderList;
    iFolderListPckg = new(ELeave) TPckgC<RFolderList>(iFolderList);

    TInt n = iFolderList.Count();
    iArgs.Set( 0, iFolderListPckg );
    SendReceive( EEncryptFile, iArgs, aStatus );
    }

    server side:
    void CServerSession::Fun(const RMessage2& aMessage)
    {

    TPckg<RFolderList> des1(iFolderList);
    TPckg<RFolderList>* des;
    des = (TPckg<RFolderList>*)aMessage.Ptr0();//pointer is used in place of ReadL()
    des1.Copy(*des);
    TInt count;
    for( count = 0; count< iFolderList.Count(); count++ )
    {
    TBuf<50> fileName;
    fileName = iFolderList[count];
    SomeFun(fileName);
    }
    }

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: passing arguments in asyncronous server

    Quote Originally Posted by mearunsingh View Post
    des = (TPckg<RFolderList>*)aMessage.Ptr0();//pointer is used in place of ReadL()
    des1.Copy(*des);
    Are you sure that it works on the target device? It would mean an unchecked access to other process' memory...

Similar Threads

  1. Mobile learning server / environment published
    By mikaset in forum News and Announcements
    Replies: 0
    Last Post: 2008-03-25, 20:50
  2. SOCKET PROGRAMMING: Client can not connect to server...
    By simbiyan in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2007-04-22, 20:00
  3. Cannot to receive data from server...
    By ramis55 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-05-09, 13:46
  4. Passing a TInt data from Client to server
    By putek20 in forum Symbian
    Replies: 2
    Last Post: 2003-10-15, 08:59
  5. passing messages between server and phone
    By exacom in forum General Messaging
    Replies: 0
    Last Post: 2003-06-17, 18:51

Posting Permissions

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