×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    11

    why RecvOneOrMore()can't receive data

    Following is my code to test socket on Symbian OS, I send a package which length is 6 and data are all 0, the server will back a package, but why I can't receive the package? Thanks a lot!!
    Code:
    void CTcpEngine::RunL()
        {
        switch(iChannelState)
            {
        case EChannelConnected:
            {
            if (iStatus==KErrNone)
                {
                // Connection was made successfully
                iStatusText=_L("\nConnection established");
                NotifyProgress();
                
                
                TText8 pack[6] = {0, 0, 0, 0, 0, 0};
                iWriteDataBuffer.Append(pack, 6);
                
                iChannelState=EChannelSending;
                iSocket.Send(iWriteDataBuffer, 0, iStatus);
                SetActive();
                }
            else
                {
                iStatusText=_L("\nFailed to connect");
                NotifyProgress();
                }
            }
            break;
    
        case EChannelSending:
            {
            // Receive data from the "server"
            iStatusText=_L("\nSent data");
            NotifyProgress();
    
            iSocket.RecvOneOrMore(iReadDataBuffer, 0, iStatus, iRecvLen);
            iChannelState=EChannelReceiving;
            SetActive();
            }
            break;
    
        case EChannelReceiving:
            {
            if (iStatus == KErrNone)
                {
                // Data was received successfully
                iStatusText=_L("\nReceived data");
                NotifyProgress();
                // Display received data in user interface
                //iStatusText=iReadDataBuffer;
                //NotifyProgress();
                }
            else
                {
                iStatusText=_L("\nError reading data");
                NotifyProgress();
                }
    
            iStatusText=_L("\nClose the connection...");
            NotifyProgress();
    
            iSocket.Close();
            iStatusText=_L("\nEnd of test.");
            NotifyProgress();
            }
            break;
        default:
            break;
            }
        }

  2. #2
    Super Contributor
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346

    Re: why RecvOneOrMore()can't receive data

    it seems your code not problem, you'd better confirm that server send response data.
    The best way is use ethereal catch data.
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    11

    Re: why RecvOneOrMore()can't receive data

    I test catch data from server on Windows, no problem.

Similar Threads

  1. Cannot to receive data from server...
    By ramis55 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-05-09, 13:46
  2. Http send and receive data
    By white_dragon in forum Symbian
    Replies: 1
    Last Post: 2005-02-02, 10:01
  3. call recv(),but receive no data, help me
    By ld_road in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2004-11-20, 13:38
  4. Http send and receive data
    By white_dragon in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2004-11-17, 06:53
  5. Problem: Connect from 7650 to another Device and Receive Data
    By matsguenther in forum Bluetooth Technology
    Replies: 0
    Last Post: 2002-11-11, 14:48

Posting Permissions

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