Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User chycai's Avatar
    Join Date
    Feb 2008
    Posts
    10
    I am newer with symbian,I want to connect symbian OS with PC(winXP) by socket,the symbian OS as client,PC as the Server. I can create the connect between them,but I can't send/receive data between them normally.
    On first and second session the client and the server are correct,but on the third session the server can send data correctly,but the client(symbian os) can't send data to server and the connection is OK. Anyone know the reason? I worry about it all the times. Here my part source code are:
    The Client:

    iStatus = KRequestPending;
    iSocket.Connect(iAddress, iStatus);
    User::WaitForRequest(iStatus);
    if (iStatus.Int() ==KErrNone)
    {
    TSockXfrLength iDummyLength;
    TInt recvSize;

    for( ; ; )
    {
    //iStatus = KRequestPending;
    //iSocket.Connect(iAddress, iStatus);
    //User::WaitForRequest(iStatus);
    recvSize = 0;
    iStatus = KRequestPending;
    iSocket.RecvOneOrMore(recvBuf, 0, iStatus, iDummyLength);
    User::WaitForRequest(iStatus);
    recvSize = iDummyLength();

    if(iStatus.Int() ==KErrNone)
    {

    if(recvSize !=0)
    {
    //LaunchAppL();
    //LaunchPyScriptL(recvBuf);
    recvBuf.FillZ();
    recvSize =0;

    iStatus = KRequestPending;
    iSocket.Write(writeBuf,iStatus);
    User::WaitForRequest(iStatus);
    }
    else
    {
    break;
    }
    }
    else
    {
    break;
    }

    }
    }

    The Server(winsocket):
    int i=0, length = 0;

    while(!done)
    {
    memset(buff1,0,sizeof(buff1));

    if(i == 4)
    {
    done = true;
    }
    for(i=0; i<4; i++)
    {
    strcpy(buff1, "test.py");
    send(sc,buff1,getSize(buff1),0);

    memset(buff2,0,sizeof(buff2));
    recv(sc,buff2,1024,0);
    length = strlen(buff2);

    if(length !=0)
    {
    cout<<"Received msg:";
    cout<<buff2<<endl;
    buff2[length-1] = '\0';buff2[length-2] = '\0';

    }
    }

    }
    Thandks in advance.

  2. #2
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,672
    Have you tried with sockets example already ?
    It is known to work, as well as you could copy the Active object usage from it to make your application to respond better.

  3. #3
    Registered User chycai's Avatar
    Join Date
    Feb 2008
    Posts
    10
    To symbianyucca:
    I have tested with the symbian sockets——a sample,but it has the same problem. My server codes can communicate with j2me clint socket codes well, but can't work with symbian socket. What a strange thing!

  4. #4
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,672
    What happens in there ?
    What gets executed in teh device, and what doesn't ?

  5. #5
    Regular Contributor nmnir's Avatar
    Join Date
    May 2003
    Posts
    471
    try removing iStatus = KRequestPending;

    Nahum

Similar Threads

  1. Problem with sending data on connected UDP socket (S60 3rd MR2)
    By jeeza2006 in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2008-01-04, 08:54
  2. Socket TCP/IP data transmission failed..on 6680
    By yilunyou in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-11-19, 04:12
  3. 6600 gprs 发送大量rtp延时问题
    By dicson_hu in forum Symbian
    Replies: 9
    Last Post: 2005-11-04, 02:12
  4. 6680 Problem - Data Disappears
    By gagankaul in forum General Development Questions
    Replies: 6
    Last Post: 2005-10-24, 05:59
  5. Replies: 2
    Last Post: 2004-09-15, 22:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved