Re: Unicast UDP Server



Wow, this is great. All this time I have been confusing bind and connect. Thank you for the detailed explanation.

For the record, I still have to bind to a _local_ IP address for UDP sockets in order for the receive data callback to be invoked. From what I gathered from your post, invoking "connect" with a remote address in a UDP socket will ensure that the receive callback is only invoked with data received from the specified remote address, correct?

Continued below.

By the way...IMHO, you shouldn't be messing with the socket buffer sizes
unless you have already gotten everything else working, you know exactly
what you're doing, _and_ you have run into some problem that requires you to change the default buffer sizes.

We started off with defaults and lost too many packets. 75 MB ended
up being a good number. Most of our machines are running with 4 GB or
more of memory, so it isn't an issue.

Okay. If you're running all of this on a LAN, over a gigabit network, in an extremely high-volume situation, that _might_ be reasonable. Otherwise, that's an awful lot of data to pile up without your servers being able to process it. If one or more of those descriptions don't apply to your situation, you could (and should IMHO) probably fix the issue in a more appropriate way (i.e. just fixing the code so that it's more responsive).

The code has been rewritten using unmanaged code to get a significant speed up over the original C++ implementation. Without the 75 MB receive buffer, we _occasionally_ find the buffer overfilling.

In running a profiler, it appears the code is processing the data as fast as the OS is invoking the asynchronous callback. As a test, I wrote a receive callback that only sucked data off the socket and put it into an internal buffer for processing. We were still encountering an overflow ... very odd. Maybe it is the actual NIC we're using? Or is it a limitation of Windows XP and Windows 2003 Server? This is a tough one to figure out.
.



Relevant Pages

  • Re: server scenario - variables in the right spot?
    ... If I'm correct in what I think you mean by 'data structures' then I also ... steps, the command has, and a way to mark which steps are done or not done, ... Assuming you are using the same receive callback for each BeginReceive, ... that processes the data for the first buffer. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Unicast UDP Server
    ... From what I gathered from your post, invoking "connect" with a remote address in a UDP socket will ensure that the receive callback is only invoked with data received from the specified remote address, correct? ... Without the 75 MB receive buffer, we _occasionally_ find the buffer overfilling. ... You haven't made any mention as to what your actual network speed and load is, but I'll reiterate my previous statement: only on the fastest networks, under the highest loads, should a buffer of 75MB be useful. ... If you are seeing delays that long, there's probably a better way to deal with them. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [PATCH 3/3] relay: Add buffer-only channels; useful for early logging.
    ... 20d8b67c06fa5e74f44e80b0a0fd68c8327f7c6a) broke LTTng. ... buffer file creation callback to be called when it calls relay_open. ... Therefore, such channels can be ...
    (Linux-Kernel)
  • Re: Threads for ongoing processes
    ... setting up MME to call your callback function when done with each. ... in the callback function (that is called when a buffer has played), ... (Or use some other mechanism such as Windows' SetEvent to trigger ...
    (alt.comp.lang.borland-delphi)

Loading