×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    3

    Post Problem in working with active object.....

    Hi friends...

    kindly have a look into this code...

    void CWebClientEngine::ServiceProviderMethodL()
    {
    //gConsole->Printf(_L("Starting!\n"));
    TUint KTestPort=5000;
    // KInetAddrLoop is a predefined Constant in in_sock.h represents 127.0.0.1
    TInetAddr addr(KInetAddrLoop, KTestPort);

    User::LeaveIfError(socketServ.Connect());
    CleanupClosePushL(socketServ);//if function leaves ensure socket serv session closes

    //Opens a socket by creating a new subsession to the socket server.
    User::LeaveIfError(listener.Open(socketServ, KAfInet,KSockStream, KProtocolInetTcp));
    User::LeaveIfError(listener.Bind(addr));// bind the client address
    // the arg 1 represents only one socketconnection can wiat to make conn with ths listener
    User::LeaveIfError(listener.Listen(2));// listen for response from the client,1 conn it accpts

    blank.Open(socketServ);//open connection to the client
    listener.Accept(blank, iStatus); // accept the connection from the remote client

    }
    void CWebClientEngine:: StartTask(){

    TRequestStatus *status = &iStatus;
    if(IsActive())User::RequestComplete(status,KErrNone);
    ServiceProviderMethodL();
    SetActive();
    }

    void CWebClientEngine:: RunL(){
    TSockXfrLength dummyLength;
    if(iStatus != KErrNone) User::Leave(KErrGeneral);// if error , leave
    blank.RecvOneOrMore(uri, 0, iStatus, dummyLength);// now read i/p from the client
    User::WaitForRequest(iStatus);// wiat while reading i/p
    if(iStatus != KErrNone) User::Leave(KErrGeneral);// check if everything went well, else leave
    IssueHTTPGetL(uri);
    if(iStatus != KErrNone) User::Leave(KErrGeneral);
    blank.Close();
    listener.Close();
    CleanupStack::Pop(&socketServ);
    socketServ.Close();
    StartTask();

    }
    void CWebClientEngine:oCancel(){
    //Cancel();
    }

    TInt CWebClientEngine::RunError(TInt err){
    return err;
    }

    for the first socket connection , the event was handled successfully(with invoking RunL())
    for the next immediate connection, the listener doesn't listen

    pls help me if any one gets the idea

    thanks in advance,

    dns

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: Problem in working with active object.....

    Stick with your other nick and your other thread http://discussion.forum.nokia.com/fo...d.php?t=164495

Similar Threads

  1. Active Object problem
    By xhsoldier in forum Symbian
    Replies: 6
    Last Post: 2006-07-27, 21:35
  2. Help me solve an active object problem!!!
    By hoy_cpe in forum Symbian
    Replies: 4
    Last Post: 2006-06-30, 22:26
  3. Replies: 1
    Last Post: 2005-10-10, 05:06
  4. Active Object problem
    By giudicea in forum Symbian
    Replies: 1
    Last Post: 2003-11-03, 09:06
  5. Replies: 1
    Last Post: 2002-08-28, 09:12

Posting Permissions

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