Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User ginomi's Avatar
    Join Date
    Mar 2003
    Posts
    15
    How to listen and accept socket? I tried this, but a eSock panic 7 is raised in the real device...

    Code:
    User::LeaveIfError(iSocketServ.Connect());
    
    User::LeaveIfError(iSocket.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp));
    
    // Set up address information
    const TUint32 KInetAddr = INET_ADDR(127,0,0,1);
    iAddress.SetAddress(KInetAddr);
    iAddress.SetPort(4444);
    
    iSocket.Bind(iAddress);
    
    iSocket.Listen(5);
    
    RSocket aSocket;
    
    User::LeaveIfError(aSocket.Open(iSocketServ));
    
    iSocket.Accept(aSocket, iStatus);
    
    iWriteBuffer= _L8("hello");
    
    aSocket.Write(iWriteBuffer,iStatus);
    
    
    aSocket.Close();
    iSocket.Close();
    iSocketServ.Close();
    tnx,

    Gino

  2. #2
    Registered User cdouble's Avatar
    Join Date
    Mar 2003
    Posts
    6
    An Esock 7 panic is 'Accept request made while already attempting to accept'. From the looks of your code it's because you do the Write before waiting on the accept. Change the appropriate lines of code to be something like:

    iSocket.Accept(aSocket, iStatus);
    User::WaitForRequest(iStatus);
    iWriteBuffer= _L8("hello"
    aSocket.Write(iWriteBuffer,iStatus);
    User::WaitForRequest(iStatus);

    Chris.
    --
    http://radio.weblogs.com/0102385

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