Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Regular Contributor LesterPH's Avatar
    Join Date
    Apr 2010
    Posts
    79
    Sir I cannot modify the code in chat example S60, it has to many errors when I try to use the StatL() function under ChatInet.. any solution? I am trying to insert the function under class ChatInet but unfortunately It says undefined even though I already included all of its header files. And also I wanna know what does the carbide first execute when we compile the project, like main.cpp in c++...

  2. #2
    Regular Contributor LesterPH's Avatar
    Join Date
    Apr 2010
    Posts
    79
    Sir I cannot modify the code in chat example S60, it has to many errors when I try to use the StatL() function under ChatInet.. any solution? I am trying to insert the function under class ChatInet but unfortunately It says undefined even though I already included all of its header files. And also I wanna know what does the carbide first execute when we compile the project, like main.cpp in c++...

    tnx

  3. #3
    Nokia Developer Champion Nitesh Bhardwaj's Avatar
    Join Date
    Jan 2008
    Location
    Bangalore, India
    Posts
    777
    Sir I cannot modify the code in chat example S60, it has to many errors when I try to use the StatL() function under ChatInet.. any solution?
    what errors you are getting?
    I am trying to insert the function under class ChatInet but unfortunately It says undefined even though I already included all of its header files.
    did you defined it in .h file?
    And also I wanna know what does the carbide first execute when we compile the project, like main.cpp in c++...
    if you mean entry point, then its
    Code:
    GLDEF_C TInt E32Main()

  4. #4
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,672
    it might be easier if you would just descripe the actual errors, then somebody might be able to help.

    Anyway, the code is compiled first and once it is executed, it starts executing from the entry point, though if you have compilation errors then there is nothing that could actually be executed produced.

  5. #5
    Regular Contributor LesterPH's Avatar
    Join Date
    Apr 2010
    Posts
    79
    Sir the Chat Example was successfully compiled. and I was able to install it on my Nokia Phone.

    Now I am coding my project, I am already finished with the GUI using carbide. I wanna know what does the entry point of the chat example when compiled.
    Chat.cpp
    ChatApp.cpp
    ChatDocument.cpp
    etc.

    like main.cpp in qt.

    and the code i was referring to is this:
    void CChatInet::StartL()
    {
    if ( State() != EDisconnected )
    {
    User::Leave( KErrInUse );
    }

    User::LeaveIfError( iConnection.Open( iSocketServer, KAfInet) );

    User::LeaveIfError( iConnection.Start() );

    TInt result( 0 );

    result = iSocket.Open( iSocketServer,
    KAfInet,
    KSockStream,
    KProtocolInetTcp );

    if ( result != KErrNone )
    {
    iSocketServer.Close();
    User::Leave( result );
    }

    TInetAddr addr;
    iAddress.SetPort( iPort );
    iAddress.SetFamily( KAfInet );

    // bind
    User::LeaveIfError( iSocket.Bind( iAddress ) );

    // listen
    User::LeaveIfError( iSocket.Listen( KListeningQueSize ) );

    // close old connection - if any
    iAcceptedSocket.Close();

    // Open abstract socket
    User::LeaveIfError( iAcceptedSocket.Open( iSocketServer ) );

    iActiveSocket = &iAcceptedSocket;

    // Set the Active Object's State to Connecting indicated.
    SetState( EGettingConnection );

    iSocket.Accept( iAcceptedSocket, iStatus );

    SetServer( ETrue );

    // Set the Active Object Active again,
    SetActive();

    }

    I wanna use this function under the class ChatInet.cpp

    How will I call it in the event handler generated by Carbide in my GUI.

    tnx...

  6. #6
    Regular Contributor LesterPH's Avatar
    Join Date
    Apr 2010
    Posts
    79
    I am already finished with the GUI using carbide. I wanna know what does the entry point of the chat example when compiled.
    Chat.cpp
    ChatApp.cpp
    ChatDocument.cpp
    etc.

    like main.cpp in qt.

    and the code i was referring to is this:
    void CChatInet::StartL()
    {
    if ( State() != EDisconnected )
    {
    User::Leave( KErrInUse );
    }

    User::LeaveIfError( iConnection.Open( iSocketServer, KAfInet) );

    User::LeaveIfError( iConnection.Start() );

    TInt result( 0 );

    result = iSocket.Open( iSocketServer,
    KAfInet,
    KSockStream,
    KProtocolInetTcp );

    if ( result != KErrNone )
    {
    iSocketServer.Close();
    User::Leave( result );
    }

    TInetAddr addr;
    iAddress.SetPort( iPort );
    iAddress.SetFamily( KAfInet );

    // bind
    User::LeaveIfError( iSocket.Bind( iAddress ) );

    // listen
    User::LeaveIfError( iSocket.Listen( KListeningQueSize ) );

    // close old connection - if any
    iAcceptedSocket.Close();

    // Open abstract socket
    User::LeaveIfError( iAcceptedSocket.Open( iSocketServer ) );

    iActiveSocket = &iAcceptedSocket;

    // Set the Active Object's State to Connecting indicated.
    SetState( EGettingConnection );

    iSocket.Accept( iAcceptedSocket, iStatus );

    SetServer( ETrue );

    // Set the Active Object Active again,
    SetActive();

    }

    I wanna use this function under the class ChatInet.cpp

    How will I call it in the event handler generated by Carbide in my GUI.

    I already defined all the necessary header files.

    tnx

  7. #7
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,672
    if it is Symbian C++ application, then the Application class is made first, then document class and then application UI class. Your own codes propably are started in AppUi's ConstructL function.

  8. #8
    Regular Contributor LesterPH's Avatar
    Join Date
    Apr 2010
    Posts
    79
    I encounter undefined function when I try to call the function on my GUI.

  9. #9
    Nokia Developer Champion Nitesh Bhardwaj's Avatar
    Join Date
    Jan 2008
    Location
    Bangalore, India
    Posts
    777
    Quote Originally Posted by LesterPH View Post
    I encounter undefined function when I try to call the function on my GUI.
    you need to define it in CChatInet.h file like,
    Code:
    void StartL();
    [I am already finished with the GUI using carbide. I wanna know what does the entry point of the chat example when compiled
    already told it should be
    Code:
    GLDEF_C TInt E32Main()
    in Chat.cpp.

  10. #10
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    Is the file ChatInet.cpp referenced in your .mmp file (as SOURCE)?

  11. #11
    Regular Contributor LesterPH's Avatar
    Join Date
    Apr 2010
    Posts
    79
    thanks for all your help... I was able to understand the flow of carbide's compilation.

    If Im not mistaken the carbide first execute GLDEF_C TInt E32Main() from ChatApplication.cpp->ChatDocument.cpp->ChatAppUI.cpp.

    I think I already included all the needed header. but i still can't use the function StarL().

    I didn't define void StartL() because I included the header file of ChatInet.h. I think it is already defined in that header file.

    I want to know how to call a function when it is inside another .cpp or antother class....

    tnx

  12. #12
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,672
    you should propably read basics of C++ and object orientation. Generally you would need to construct the object that implements the function before you can use it.

  13. #13
    Regular Contributor LesterPH's Avatar
    Join Date
    Apr 2010
    Posts
    79
    sir tnx for the reply the object is already constructed. chatinet has its 2 phase constructor...

  14. #14
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,672
    so then you have an intance of it, most likely you should then store the object so you can delete it after you nolonger need it. And as you have the instance of the object, you can use all public function from it directly, thus, could you explain in details on what the problem that you are encountering is actually ?

  15. #15
    Regular Contributor LesterPH's Avatar
    Join Date
    Apr 2010
    Posts
    79
    Sir, I still can't add the function StartL() of class CChatInet. I can't call it even if I already added all the required header files.

    Inside my made AppUI I wanna call the function trough StartL()

    The construct L of the original AppUI code is:

    // ----------------------------------------------------------
    // CChatAppUi::ConstructL()
    //
    // ----------------------------------------------------------
    //
    void CChatAppUi::ConstructL()
    {
    BaseConstructL( CAknAppUi::EAknEnableSkin );
    .
    iAppContainer = CChatContainer::NewL( ClientRect() ); ---> will copy this to the constructor of my UI?

    // so view can update scroll bars
    iAppContainer->SetMopParent( this );

    AddToStackL( iAppContainer );

    iChatBt = CChatBt::NewL( *iAppContainer );
    iChatInet = CChatInet::NewL( *iAppContainer ); ---> will copy this to the constructor of my UI? whats my pointer here? is it still my chat ui container?

    // check whether BT is available or not

    RSdp sdpSession;

    if ( sdpSession.Connect() == KErrNone )
    {
    sdpSession.Close();

    iBtAvailable = ETrue;
    }
    else
    {
    iBtAvailable = EFalse;
    }
    }

Page 1 of 2 12 LastLast

Similar Threads

  1. How to create chat server and chat client using J2ME....
    By mapetos in forum Mobile Java General
    Replies: 24
    Last Post: 2011-08-08, 13:19
  2. TCP chat client using J2ME midlet
    By arun10427 in forum Mobile Java General
    Replies: 1
    Last Post: 2010-02-25, 10:25
  3. help wih TCP server/client
    By dejavu87 in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2010-02-23, 14:46
  4. What happens when a server my client is connected to on a public IP goes down
    By m4a127 in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2009-03-28, 21:09
  5. need help on developing chat server for J2ME chat client
    By sheetal_21 in forum Mobile Java General
    Replies: 6
    Last Post: 2007-09-30, 07:44

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