Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Aug 2003

    TCP Sockets listener using Active Objects...

    hi all,

    I am trying to implement TCP listener using active objects...

    From what i'v read through and understood ...active objects work as follows.

    1. the boolean value IsActive() is set to true and on calling the SetActive() method which i call after the Accept() call.

    2. As soon as the client connects to my emulator or phone (nokia 3650) the IsActive() is set to false and the RunL() method

    is called...

    3. The RecvOneOrMore(iMyBuffer, 0, iStatus, iMyDummyLength) is called inside the RunL() where i plan to handle data

    reading..and writing into stream...

    but donno for some reason...the RunL() method doesn't get called probably cause the IsActive() remains true cause the client
    is not able to connect...but the RunL() gets called on the action of some click event...!!

    the foll. is the code am using...do please check in...

    Quote :
    void CSocketsEngine::ListenL() // <a name="ConnectL32">


    User::LeaveIfError(iSocket.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp));

    #define KTestPort 8030
    TInetAddr anyAddrOnPort(KInetAddrAny, KTestPort);
    iConsole.ErrorNotify(_L("Going to bind to port 8030"), iEngineStatus);
    TInt bindStat = iSocket.Bind(anyAddrOnPort);

    if (bindStat == KErrNone) {
    TBuf8<10> stat;
    iConsole.ErrorNotify(_L("Bind Success"), iEngineStatus);

    //Listening for socket connections
    TUint queSize = 5;
    TUint popConn;
    iConsole.ErrorNotify(_L("Before Listen Call"), iEngineStatus);
    popConn = iSocket.Listen(queSize);
    TBuf8<5> statListen;

    iConsole.ErrorNotify(_L("Listen QueSize Set"), iEngineStatus);

    //Accept every connection as and when it comes in from the
    //listen call..

    RSocket blankRSock;
    TInt blsock = 0;
    blsock = User::LeaveIfError(blankRSock.Open(iSocketServ));

    TRequestStatus reqStat(blsock);
    iConsole.ErrorNotify(_L("Awaiting client conn..."), iEngineStatus);



    UnQuote :


  2. #2
    Registered User
    Join Date
    May 2003

Posting Permissions

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