CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2009
    Posts
    2

    Exclamation UDP server strange behaviour

    Hi All,

    I have written a simple UDP client and server, and just started playing around with it. I am noticing some strange behaviour at the server end. Here is the scenario: the client sends 100 packets to the server, but at the server end, it wouldn't capture all of them. It would stop capturing after 95 packets, and the remaining 5 packets would be displayed when the client sends the next 100. I also tried adding some delay at the client end, but that didn't change the server behaviour. Any ideas why this could be happening. If need be, I can paste the code.

    Thank you,
    Vish

  2. #2
    Join Date
    Jun 2009
    Posts
    2

    Re: UDP server strange behaviour

    Ok, the server is experiencing packet loss - it doesn't receive the remaining packets as I have mentioned in the first post. Also, the packet size is set to 1470 (MTU). Thanks.

  3. #3
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    47

    Re: UDP server strange behaviour

    If I experience this issue, I will try to send < 96 packets and see whether the server captures them all.
    Xander Tan

  4. #4
    Join Date
    Dec 2008
    Posts
    56

    Re: UDP server strange behaviour

    Try augmenting the size of your server's socket receiving buffer. Here's how with Linux C++; I do not know how well this translates to VC++.

    Code:
    const int size = 1470 * 100;   // 1470 bytes * 100 messages
    
    setsockopt(socket_desc, SOL_SOCKET, SO_RCVBUF, (void *) &size, sizeof(size));
    You can also do something similar for the client's socket, but instead use SO_SNDBUF.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured