×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    105

    New in Symbian (sockets and 1024 characters)

    Hello!

    I have a weird bug here. Some how things wont work if I will send more than 1024 characters in socket. I have debuged problem very close and I have a thought what could be wrong. I have thought that you cant write over 1024 characters in socket at in time? Here is my code just in case if that over 1024 characters thought isnt the problem.


    iGSParser->GenerateSyncBodyLD(body);
    xmlPostMessage->Append(*body);
    SendRequestL(xmlPostMessage);
    delete xmlPostMessage;

    ...

    TBuf<4096>* wholeBody;
    wholeBody = new(ELeave) TBuf<4096>;
    _LIT(KUserStart, "<user>");
    wholeBody->Append(KUserStart);
    // I will add lots of stuff here. If I will add like 904 characters everything
    // works fine but after I add like 1170 characters it aint work.
    _LIT(KUserEnd, "</user>");
    wholeBody->Append(KUserEnd);
    aReturn->Copy(*wholeBody);
    delete wholeBody;
    ...

    void CGSSync::SendRequestL(TDesC* aXmlRequest)
    {
    // Request which includes header and body
    TBuf8<4000> param;
    param.Append(*aXmlRequest);

    // Lets use 8 bit buffer for request
    HBufC8* request = HBufC8::NewLC(param.Length());
    *request = param;

    // Lets give a bomb for server
    iGSHTTPClient->SendL(iServerAddr, *request);
    CleanupStack::PopAndDestroy(); // request
    }

    void CGSHTTPClient::SendL(TInetAddr &aIpAddress, const TDesC8& aDesc)
    {
    iRecvBuffer.Zero();
    iData2 = aDesc;
    iState = EGettingConnection;
    iSocket.Connect( aIpAddress, iStatus );
    SetActive();
    }

    void CGSHTTPClient:oSendL()
    {
    iSocket.Write(iData2, iStatus);
    SetActive();
    }

    void CGSHTTPClient:oReceiveL()
    {
    iRecvBuffer.SetLength(0);
    iSocket.RecvOneOrMore(iRecvBuffer, 0, iStatus, iLen);// When it arrives first time with 1170 characters IStatus value is 10054. With 904 characters value is 0 so something has happened with writing data in socket.
    SetActive();
    }

    void CGSHTTPClient::AppendToReceiveBuffer()
    {
    iData.Append( iRecvBuffer ); // I cant see anything in iRecvBuffer after I have sent 1170 characters but with 904 characters it works fine.
    iRecvBuffer.SetLength(0);
    }

    void CGSHTTPClient::FinishConnectionL()
    {
    Cancel();
    iCallb->ResponseReceived( iData );// There isnt anything in iData after using more than 1024 characters
    }

    void CGSHTTPClient::RunL()
    {
    switch (iState)
    {
    case ENotConnected:
    {
    break;
    }
    case EGettingConnection:
    {

    if(iStatus.Int() == -2)
    {
    FinishConnectionL();
    break;
    }
    else{
    iState = ESending;
    DoSendL();
    break;
    }
    }
    case ESending:
    {
    iState = EReceiving;
    iData.SetLength(0);
    DoReceiveL();
    break;
    }
    case EReceiving:
    {
    AppendToReceiveBuffer();
    if ( iStatus.Int() == KErrNone )
    {
    DoReceiveL();
    }
    else
    {
    FinishConnectionL();
    }
    break;
    }

    default:
    break;
    }
    }

  2. #2
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    105

    Re: New in Symbian (sockets and 1024 characters)

    Up we go!

    So how is it can I send more than 1024 characters in socket at once?

  3. #3
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    105

    Re: New in Symbian (sockets and 1024 characters)

    Could some help me, please!

    Did I descriped my problem too complicated or whats the thing that no one say a word, even my question is pretty trivial: "Does socket accept more than 1024 character at once?" I do not want to push you but this problem is driving me crazy

    void CGSHTTPClient::SendL(TInetAddr &aIpAddress, const TDesC8& aDesc)
    {
    // Lets use 8 bit buffer for request
    iData2 = new(ELeave) TBuf8<4096>;
    *iData2 = aDesc;

    iSocket.Connect( aIpAddress, iStatus );

    SetActive();
    }

    void CGSHTTPClient:oSendL()
    {
    //iSocket.Write(*iData2, iStatus);
    iSocket.Send(*iData2, KSIWriteOnly, iStatus); // this wont send whole buffer if its more than 1024 characters big.
    SetActive();
    }

    After DoSendL() we will go to RunL() and iStatus is 10054 that might tell something for you Pro's. Server will get stuff that we write in socket but not whole buffer if its more than 1024 characters length. Server will also send return message but socket cant get anything visible.

    -Arachidyl
    Last edited by arachidyl; 2006-04-03 at 18:06.

  4. #4
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    105

    Re: New in Symbian (sockets and 1024 characters)

    Omg!

    It works fine in cell phone

    I think this prnesock.lib doesnt support over 1024b packet sending. Well there isnt anything new because it aint support every functions that objects offer.

    In .MMP

    #if defined(WINS)
    LIBRARY prnesock.lib
    #else
    LIBRARY esock.lib
    #endif

    Btw. Could someone drop a single comment about this case because im not sure if im speaking a truth here...im still a bit new one in Symbian C++...

Similar Threads

  1. Bug in Symbian Word for 7710
    By harnevie in forum Symbian
    Replies: 0
    Last Post: 2005-04-28, 01:42
  2. Current Symbian Development Opportunities...!!
    By mobile2004 in forum Symbian
    Replies: 0
    Last Post: 2005-01-17, 17:58
  3. Replies: 0
    Last Post: 2004-05-21, 11:16
  4. Replies: 2
    Last Post: 2004-05-08, 09:09
  5. Replies: 0
    Last Post: 2004-05-07, 11:45

Posting Permissions

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