×

Discussion Board

Results 1 to 5 of 5

Thread: Sending UDP

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    17

    Sending UDP

    Hi all,

    i have a follow problem:

    I want send continuously a udp broadcast using sockets via WLAN.

    But after 8-9 packets the application stops sending the packets. does enybody have idea why?
    Is that an property of active objects?

    Thank you,

    Dejan

  2. #2
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: Sending UDP

    Certainly active objects don't have that "property". Most likely you have some problem in your code. Of course it's hard to tell without having further details.

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    17

    Re: Sending UDP

    Thank you for replay!

    i have one function to send the udp: sendboroadcast().

    void CSocket :: SendBroadcast()
    {
    customMessage.Zero();
    customMessage.Copy(_L8("Hallo World"));

    iSendingSocket.SendTo(customMessage,iAddress,0,iStatus);

    iCounter++;

    CleanupStack::PopAndDestroy();

    SetActive();

    }

    void CSocket :: RunL()
    {
    if(iCounter < 50)
    {
    SendBroadcast();

    }
    else {
    iCounter = 0;
    iSendingSocket.CancelAll();
    iSendingSocket.Close();
    iConnection.Close();
    iSocketServ.Close();
    }

    }

    The number of UDP Packets that are sent is always 8-9!!

    Best regards

    Dejan

  4. #4
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: Sending UDP

    1. Is customMessage a local variable? Make it a member if it is. BTW the Zero() call is not needed, as Copy() will overwrite any existing content in the descriptor

    2. What's the CleanupStack::PopAndDestroy(); purpose?

    3. Also it's a good thing to check the iStatus error code in RunL, at the very least for debugging purposes

  5. #5
    Registered User
    Join Date
    Aug 2007
    Posts
    14

    Re: Sending UDP

    But after 8-9 packets the application stops sending the packets. does enybody have idea why?
    Probably, because the Symbian UDP sockets have a little bit peculiar default: if your application sends faster that the outgoing interface can deliver, then once the outgoing queue in driver becomes full, the IP stack promptly drops all subsequent packets (and completes the write immediate) until the driver has more space.

    But, as program is very fast, before driver has had time to make room, application may have virtually sent thousands of packets to the bit bucket...

    Check out the socket option "KSoUdpSynchronousSend" (see in_sock.h header) and set it on for your UDP sockets. Then, your Send/Write complete calls RunL will occur actually only after the stack has delivered the packet to the driver, and the stack will not drop any of the outgoing packets.

Similar Threads

  1. Problem with sending data on connected UDP socket (S60 3rd MR2)
    By jeeza2006 in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2008-01-04, 08:54
  2. UDP stops sending after a few mins
    By rjcauc81hi in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2007-08-09, 15:46
  3. N71 crash when sending UDP packet
    By 9barkda in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2007-02-06, 14:13
  4. how to use udp, for sending data server to client
    By acayir in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-08-02, 19:18
  5. How to sending Broadcast message using UDP via Wifi on 9500?
    By oslario in forum Symbian Networking & Messaging (Closed)
    Replies: 9
    Last Post: 2006-02-03, 00:49

Posting Permissions

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