×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Regular Contributor
    Join Date
    Jun 2007
    Posts
    52

    Problem with RecvOneOrMore in recieving server response

    Hi All,
    I'm Very New to Symbian Development.I'm trying to implement Chat Application with Socket Programming.Actually Im able to coonect to my server and on successfull connection im trying to send the Login details to my server.Login Details are successfully reaching to server but here im using 'RecvOneOrMore' method to recieve the server response.But this method is recieving full amount of data when i use 'User::WaitForRequest(iStatus)' statement after that.But it's hanging for the next server responses.If i remove that 'RecvOneOrMore' is not recieving any data.

    I got struck here,please help me in solving this.

    My Sample code to recieve the server response is:


    Code:
    TBuf8<1000> iBuffer;
    void CMySocketConnection::RequestData()
        {
        if ( iActiveSocket )
            {
            iActiveSocket->RecvOneOrMore( iBuffer, 0, iStatus, iLen );
    
            User::WaitForRequest(iStatus);    --> If i comment this, No data is recieved in iBuffer
            
            }
        SetActive();
        }
    Thanks in Advance.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: Problem with RecvOneOrMore in recieving server response

    just remove the User::WaitForRequest(iStatus); , and move the SetActive(); in its place, also RSockets should not be used as pointers, so do check the right usage for R-Classes. Then see what happens in your RunL when it gets called.

  3. #3
    Regular Contributor
    Join Date
    Jun 2007
    Posts
    52

    Re: Problem with RecvOneOrMore in recieving server response

    Hi symbianyucca,
    Thank you very much for your reply.I did the both changes what u mentioned.Then also i'm not able to recieve the server response.

    Below is modified code snippet:
    Code:
    TBuf8<1000> iBuffer;
    void CMySocketConnection::RequestData()
        {
        if ( iActiveSocket )
            {
            iActiveSocket.RecvOneOrMore( iBuffer, 0, iStatus, iLen );
    
            SetActive();// User::WaitForRequest(iStatus);
            
            iTransactionObserver->SuccessL(0,&iBuffer,KErrNone);   //where iTransactionObserver is a Observer class
            }
        }
    And i'm also having another doubet that whether it might be buffer problem,means i need to use HBufC8 here .im using TBufC8 now.is this OK.

    Thanks in advance.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: Problem with RecvOneOrMore in recieving server response

    plase do read Active objects bacis first, you do need to wait untill the RunL is called, then you will get your data.

  5. #5
    Registered User
    Join Date
    Aug 2004
    Location
    Hyderabad,India
    Posts
    808

    Re: Problem with RecvOneOrMore in recieving server response

    hi,

    Read buffer in RunL().

    // Active object request complete handler
    if (iStatus == KErrNone)
    //Use iBuffer here. iBuffer should be class variable of ur class CMySocketConnection and should not be local variable




    Regards,
    Sudhakar
    Regards,
    Sudhakar

  6. #6
    Regular Contributor
    Join Date
    Jun 2007
    Posts
    52

    Re: Problem with RecvOneOrMore in recieving server response

    Hi symbianyucca & S.S.Sudhakar,
    Thanks for ur replies,actually i'm calling this 'RequestData' method in 'RunL' call back method only.And the 'iBuffer' which u mentioned is Class variable only.
    in RunL function for the (iStatus == KErrorNone),im calling the 'RequestData' method where i'm trying to receive the Server response.

  7. #7
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: Problem with RecvOneOrMore in recieving server response

    so what happens then?,
    and what statest you ahve had before you get there ?

  8. #8
    Regular Contributor
    Join Date
    Jun 2007
    Posts
    52

    Re: Problem with RecvOneOrMore in recieving server response

    Hi symbianyucca,
    As above mentioned ,on successfull server response im navigating to another view which displays the buddy lists from recieved data.But the problem is,after that Application is hangining(Not able to perform anything on that view/container) and not recieving any more data from server.
    And one more important point is that,If i put logs for this without navigating to New view,Sending/Recieving of server response is very successfull .But when trying to Navigate to New View after server response im getting this problem.So please help me where im going wrong and what might be the solution.

  9. #9
    Regular Contributor
    Join Date
    Jun 2007
    Posts
    52

    Re: Problem with RecvOneOrMore in recieving server response

    Hi All,
    Thanks for ur valuable replies,My Above problem got solved as i was misplaced the Observer method and was using 'User::WaitForRequest(iStatus)' command to get the data.Now im able to send & recieve messages continuously.
    But im facing another problem as,Actually im using TBuf8 to recieve the data So if the data is more than Buffer limit client gets crashed.So i want to use Dynamic Buffer (HBufC8) to hold the recieved data.In order to use HBufC8,i need to create the Object with Recieved Data Length which i can't get it before the reception.How I can Copy the Total recieved data of watever maximum length.

    Code:
    My Sample Code to Recieve the data is:
    
    TBuf8<1000> iBuffer; //Member Variable
    void CMySocketConnection::RequestData()
        {
        if ( iActiveSocket )
            {
    		//Copy the Recieved Data to a Buffer
    		iActiveSocket->RecvOneOrMore( iBuffer, 0, iStatus, iLen ); //Here i want to use HBufC8 instead TBuf8.
    			
    	}
    	SetActive();
        }
    Thanks in Advance.

  10. #10
    Regular Contributor
    Join Date
    Jun 2007
    Posts
    52

    Re: Problem with RecvOneOrMore in recieving server response

    Please any one Help me im awaiting for the reply.

  11. #11
    Regular Contributor
    Join Date
    Jun 2007
    Posts
    52

    Re: Problem with RecvOneOrMore in recieving server response

    Hi All,
    Temporarily i'm using TBuf8 only to recieve the data with increased Buffer length.
    But here im facing one more problem that,Length of the Recieved iBuffer Data is different on When running Client on debug mode and Normal run mode for the Same Server response(Data Length 4260).

    Breif Description:
    Actual Data Length is : 4260
    Recieved Data Length on Emulator Run mode or On Device is : 2920
    Recieved Data Length on Emulator Debug Mode is : 4260

    So,When i run the Application on Device or Emulator Run mode, Complete Data is not getting recieved.What may be the problem here.Please help me in solving this.

    Thanks in Advance.

  12. #12
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: Problem with RecvOneOrMore in recieving server response

    RecvOneOrMore completes as soon as possible. You should re-issue the request and collect the results into some buffer until you get the complete message.

  13. #13
    Regular Contributor
    Join Date
    Jun 2007
    Posts
    52

    Re: Problem with RecvOneOrMore in recieving server response

    Hi wizard_hu_,
    Thank you for your reply,Actually I tried by replacing 'RecvOneOrMore' with 'Recv' & 'Read'.It's able to receive the Actual Data(whole length of 4260) But taking lot of time almost 10 minutes for Data length 4260 which will be a problem again.
    So is there any solutions with Recv/Read functions so that data will get recieved in quick time or reply what u gave is the only problem for this.
    If that So how i need to call RecvOneOrMore function again & again until complete data gets recieved because i can't know the recieved data length.
    The Data Length what i posted is,I came to know by putting Log values.

    So please suggest me good solution,Thanks in advance.

  14. #14
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: Problem with RecvOneOrMore in recieving server response

    Recv/Read does not complete until they succeed in filling the complete input buffer you pass.
    You can either do some magic using TPtr8::Set, and create a descriptor with exactly matching size, or issue RecvOneOrMore-s until you get all the data you expect.
    Personally I tend to use the second approach, and collect the data into a CBufFlat, then extract and process the first n bytes. This way it is also fine if the other party has already started sending the next message, and I receive some bytes of it.

  15. #15
    Regular Contributor
    Join Date
    Jun 2007
    Posts
    52

    Re: Problem with RecvOneOrMore in recieving server response

    Hi wizard_hu_,
    Thanks for ur reply,If i try to call 'RecvOneOrMore' again again may not solve my problem.Bcoz server sending lot of other responses after this.So 'RecvOneOrMore' may get the next response data rather than first request incompleted data.
    and one more problem is that,actually i am facing this in getting login buddy lists only.and for other responses(like send/read messages) it's getting exact data.So if i tend to use RecvOneOrMore, more times will not be a good idea.
    And regarding,to use TPtr8::Set method,Im not able to do any kind of magic ,if u can help me in this im very thankful to u.

Similar Threads

  1. Problem : Funambol DM server and Symbian Emulator
    By vinod_mrd in forum OMA DM/DS/CP
    Replies: 1
    Last Post: 2008-12-02, 02:23
  2. HTTP Post problem on Symbian 9.2 - TCP stuck?
    By bgenady in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2008-08-04, 19:33
  3. Problem retreiving custom HTTP response header
    By hmeet2 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-01-03, 09:35
  4. Nokia 6600 Socket Server send delay Problem
    By dicson_hu in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-10-31, 07:37
  5. Problem Starting the server
    By Nokia_Archived in forum WAP Servers
    Replies: 1
    Last Post: 2002-05-14, 18:03

Posting Permissions

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