Re: Unicast UDP Server
- From: "O.B." <funkjunk@xxxxxxxxxxxxx>
- Date: Sat, 29 Mar 2008 17:18:19 -0500
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.
.
- Follow-Ups:
- Re: Unicast UDP Server
- From: Peter Duniho
- Re: Unicast UDP Server
- References:
- Unicast UDP Server
- From: O.B.
- Re: Unicast UDP Server
- From: Peter Duniho
- Re: Unicast UDP Server
- From: O.B.
- Re: Unicast UDP Server
- From: Peter Duniho
- Unicast UDP Server
- Prev by Date: Re: Location of Context Menu in Listview
- Next by Date: Re: Location of Context Menu in Listview
- Previous by thread: Re: Unicast UDP Server
- Next by thread: Re: Unicast UDP Server
- Index(es):
Relevant Pages
|
Loading