×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    10

    getting error in listen api..

    iAddress.SetPort(7080);

    iAddress.SetAddress(INET_ADDR(10,42,25,103));
    iSocketServer.Connect();
    CleanupClosePushL(iSocketServer);

    TInt errno,errno1,errno2;
    errno=iSocket1server.Open(iSocketServer,KAfInet,KSockStream, KProtocolInetTcp);

    if(errno!=KErrNone)
    {
    CAknInformationNote* note= new(ELeave) CAknInformationNote;
    note->ExecuteLD(_L("Error opening socket...\n"));
    }
    else
    {
    CAknInformationNote* note= new(ELeave) CAknInformationNote;
    note->ExecuteLD(_L(" opened socket...\n"));
    }

    errno1=iSocket1server.Bind(iAddress);

    if(errno1!=KErrNone)
    {
    CAknInformationNote* note= new(ELeave) CAknInformationNote;
    note->ExecuteLD(_L("Error binding socket...\n"));
    }

    else {
    CAknInformationNote* note= new(ELeave) CAknInformationNote;
    note->ExecuteLD(_L("binded socket...\n"));
    }



    errno2=iSocket1server.Listen(1);

    if(errno2!=KErrNone)
    {
    CAknInformationNote* note= new(ELeave) CAknInformationNote;
    note->ExecuteLD(_L("Error listening...\n"));
    }

    else
    {
    CAknInformationNote* note= new(ELeave) CAknInformationNote;
    note->ExecuteLD(_L(" listened...\n"));
    }


    iSocket1.Open(iSocketServer);

    iSocket1server.Accept(iSocket1, iStatus );

    User::WaitForRequest(iStatus );

    if(iStatus != KErrNone) User::Leave(KErrGeneral);
    {
    CleanupStack::Pop(&iSocketServer);
    iSocketServer.Close();
    }

    iEngineStatus=ESending;
    SetActive();
    }
    -------------------------
    in header file

    RSocket iSocket1server;

    RSocket iSocket1;
    TInetAddr iAddress;

    RSocketServ iSocketServer;
    TBuf8<50> iResponse;


    hi,
    i am new to symbian,can any one help me!
    this is the code i am using , getting error in listen,

  2. #2
    Regular Contributor
    Join Date
    Sep 2007
    Posts
    247

    Re: getting error in listen api..

    what error code you are getting in case of listen failure?

    and change the bottom of your source code as

    ....
    Socket1.Open(iSocketServer);

    iSocket1server.Accept(iSocket1, iStatus );
    SetActive();
    iEngineStatus=ESending; // or move this line at some appropriate locatin in your code
    }
    and then implement CActive::RunL() and handle the error codition or any other state there as

    void CMyClass::RunL()
    {
    if(iStatus != KErrNone)
    {
    CleanupStack::Pop(&iSocketServer);
    iSocketServer.Close();
    }
    }

    for more info, you can read the active objects in SDK.

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    10

    Re: getting error in listen api..

    CAknInformationNote* note= new(ELeave) CAknInformationNote;
    note->ExecuteLD(_L("Error listening...\n"));
    this statement diplaying as Error listening...

  4. #4
    Regular Contributor
    Join Date
    Sep 2007
    Posts
    247

    Re: getting error in listen api..


    but can you please tell us what is the value of errno2?

    -jupitar

  5. #5
    Regular Contributor
    Join Date
    Sep 2007
    Posts
    247

    Re: getting error in listen api..

    and try increasing the listen queue size as well, as

    errno2=iSocket1server.Listen(2);

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

    Re: getting error in listen api..

    change your code to display errono2

    if(errno2!=KErrNone)
    {
    TBuf<100> buf;
    buf.Append(_L("Error listening = "));
    buf.AppendNum(errno2);
    CAknInformationNote* note= new(ELeave) CAknInformationNote;
    note->ExecuteLD(buf);
    }

    and paste the error info.
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  7. #7
    Registered User
    Join Date
    Nov 2008
    Posts
    10

    Re: getting error in listen api..

    hi,
    i am working emulator as server in one system, & another emulator as client in other system.
    there was a binding error, when i was debugging the code..
    my doubt is whether emulator will work as server ?
    i am working in s60 2nd edition..

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

    Re: getting error in listen api..

    Quote Originally Posted by query123 View Post
    there was a binding error, when i was debugging the code
    That is really interesting.
    Note that most people around here are extremely intrusive, they probably still want to know the error code itself, not only its existence.

Similar Threads

  1. PC Suite error: (Code: Init IMediaControl2) HELP?!
    By chunkyspudmonkey in forum General Development Questions
    Replies: 30
    Last Post: 2014-07-15, 05:44
  2. Is there a C++ API for the video player
    By avbrozhko in forum Symbian
    Replies: 9
    Last Post: 2008-06-06, 14:34
  3. How to obtain Location API
    By Tiger79 in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2007-04-27, 05:37
  4. Browser Control API questions
    By Víctor Penela in forum Symbian
    Replies: 0
    Last Post: 2007-04-23, 17:01
  5. SyncML API example or tutorial
    By rab_gandhi in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-03-07, 04:52

Posting Permissions

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