×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 30 of 30
  1. #16
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: udp client crashes on SendTo (S60)

    void CSocket_UDPContainerView::Sen_UDP()
    {
    TBuf8<100> aData;

    TRequestStatus astatus;
    TInetAddr servAddr;

    servAddr.SetAddress(INET_ADDR(111,11,11,111));
    servAddr.SetPort(200);

    aData.Copy(_L("Test Data"));

    socket.SendTo(aData, servAddr, 10, astatus);
    SetActive();
    User::WaitForRequest(astatus);
    }

    I changed the code, but it is giving SetActive() undeclared error..
    Can anyone suggest how to remove this error - I'm new to active objects

  2. #17
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    How do i add active object class my class?? Then what must be done to access function such as SetActive() ??

  3. #18
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: udp client crashes on SendTo (S60)

    Quote Originally Posted by Griffolyon-aka-Rick View Post
    I'm new to active objects
    http://www.developer.nokia.com/Commu..._in_Symbian_OS
    http://www.developer.nokia.com/Commu.../Active_object

    Are you coding a Non-GUI application?
    if so, please note that:
    http://www.developer.nokia.com/Commu...tive_Scheduler
    and from SDK docs, CActiveScheduler needs:
    Location: e32base.h
    Link against: euser.lib

    regards

  4. #19
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: Application Crashing after Receiving few UDP packets

    Quote Originally Posted by Griffolyon-aka-Rick View Post
    How do i add active object class my class?? Then what must be done to access function such as SetActive() ??
    It's not recommended to post the same question twice and resuming an old thread, anyway...:
    http://www.developer.nokia.com/Commu...l=1#post906337

    And it's always high recommended to have a look at the very broad Wiki section :-)

    regards
    pg

  5. #20
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: udp client crashes on SendTo (S60)

    This code is just wrong. SetActive is inseparably paired with iStatus. astatus is your local variable, and you wait for it with User::WaitForRequest anyway.
    So remove astatus and use iStatus instead. And also remove the User::WaitForRequest (but keep the SetActive).

    (Posts from the old thread are merged here, keep these recent messages in one place)

  6. #21
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    @pavarang
    I'm developing a GUI App

    @wizard_hu
    I'll try the way u suggested..
    Does that mean i can eliminate use of variable aStatus and directly use iStatus?

  7. #22
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,169

    Re: Application Crashing after Receiving few UDP packets

    Quote Originally Posted by Griffolyon-aka-Rick View Post
    Does that mean i can eliminate use of variable aStatus and directly use iStatus?
    Yes, and you don't need to define iStatus either, its defined for the CActive class already, so you get it when you derive your active object from CActive base class.

  8. #23
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    I have added CActive to my base class in header file with e32base.h in include also
    class CSocket_UDPContainerView : public CAknView, public MExampleTimerNotify, public CActive

    I changed my code to the below and no error is showing in this part of code
    void CSocket_UDPContainerView::Sen_UDP()
    {
    TBuf8<100> aData;

    TInetAddr servAddr;

    servAddr.SetAddress(INET_ADDR(111,11,11,111));
    servAddr.SetPort(200);

    aData.Copy(_L("Test Data"));

    socket.SendTo(aData, servAddr, 10, iStatus);
    SetActive();
    }

    Now I'm getting an error "no matching function for call to CActive::Active()" at beginning of this function
    CSocket_UDPContainerView::CSocket_UDPContainerView()
    {
    iSocket_UDPContainer = NULL;
    udpTimer = NULL;
    }

    & virtual functions are abstract, cannot allocate an object of type CSocket_UDPContainerView, CBase is an ambigous base of 'CSocket_UDPContainerView' at the first 2 lines of definition
    CSocket_UDPContainerView* CSocket_UDPContainerView::NewLC()
    {
    CSocket_UDPContainerView* self = new ( ELeave ) CSocket_UDPContainerView();
    CleanupStack::PushL( self );
    self->ConstructL();
    return self;
    }

    I think it is due to some wrong initialization of active scheduler. I tried different ways mentioned in the docs you have suggested but with no results
    Can you help me to get things right..

  9. #24
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,169

    Re: Application Crashing after Receiving few UDP packets

    You should not derive the CActive in the same class that you do CAknView, instead do move thye active objects stuff into a new class, and derive it from CActive

  10. #25
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    Quote Originally Posted by symbianyucca View Post
    You should not derive the CActive in the same class that you do CAknView, instead do move thye active objects stuff into a new class, and derive it from CActive
    So i need to create a new class and derive active object from it right??
    All the supporting variables i have declared it in CSocket_UDPContainerView, will accessing those values in new class will create issues??

    Also i tried porting the app in E6 phones i have.. it is sending and receiving packets, but Iam not able to access the IP address from Socket

    TInetAddr addr;
    TBuf<64> aIP;
    addr = TInetAddr::Cast(iNameRecord.iAddr);
    addr.SetPort(200);
    addr.Output(aIP);

    I tried accessing aIP it is returning '::1' - Same code is showing valid address during debug

  11. #26
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    Thanks
    Now the app is not crashing. It is working fine.

    Now I'm trying to figure out why some junk value is coming as IP address when i call "addr.Output(aIP);"

    Thanks everyone for the valuable help

  12. #27
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: Application Crashing after Receiving few UDP packets

    ::1 is the compact form for localhost in IPv6. The same thing would be 127.0.0.1 with IPv4.

  13. #28
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    Quote Originally Posted by wizard_hu_ View Post
    ::1 is the compact form for localhost in IPv6. The same thing would be 127.0.0.1 with IPv4.
    But I'm able to send packets to my server using that socket and it is reaching there with a valid IP..
    Is there any way to access the IP address by the device itself??
    I don't understand why it behaving differently in Symbian 3.. Functionally everything is working fine.

    Should i start a new post for this query??

  14. #29
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: Application Crashing after Receiving few UDP packets

    Quote Originally Posted by Griffolyon-aka-Rick View Post
    But I'm able to send packets to my server using that socket and it is reaching there with a valid IP..
    Yes, in this thread maybe you'll find a more detailed explanation of wizard_hu_ answer:
    http://www.developer.nokia.com/Commu...ation-is-using

    Quote Originally Posted by Griffolyon-aka-Rick View Post
    Is there any way to access the IP address by the device itself??
    Yes, maybe one of these could help you, if you haven't found them yet:
    http://www.developer.nokia.com/Commu...and_Interfaces
    http://www.developer.nokia.com/Commu...ymbian_C%2B%2B

    regards,
    pg

  15. #30
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    Quote Originally Posted by pavarang View Post
    Yes, maybe one of these could help you, if you haven't found them yet:
    http://www.developer.nokia.com/Commu...ymbian_C%2B%2B

    regards,
    pg
    Thanks..
    I got what i was looking for in this link..

Similar Threads

  1. Replies: 5
    Last Post: 2012-09-04, 08:25
  2. RTP stopped receiving after 100 packets
    By interface_johnson in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2010-10-04, 08:22
  3. Replies: 5
    Last Post: 2010-09-07, 13:35
  4. which socket should i use for receiving packets
    By ahmad_aljallad in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2008-10-23, 04:17
  5. Loss packets when receiving multi-packets data
    By witchsnk in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2008-04-25, 14:10

Posting Permissions

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