[Gambas-user] odd gb3 issue

Ian Haywood ihaywood at ...1979...
Fri Jun 3 14:03:19 CEST 2011


On Fri, Jun 3, 2011 at 4:36 PM, Kevin Fishburne
<kevinfishburne at ...1887...> wrote:

> I inserted a 100 ms delay between packet transmission and this corrected
> the issue. Any insight still appreciated, as I may have to differentiate
> between LAN clients and WAN clients so the delay is only inserted when
> necessary.
the first thing you should do is ask yourself again why you can't use TCP,
as it includes fairly fancy flow-control algorithms that have been honed
over the last 30 years by some very smart engineers.

If you want to stick with UDP, one option is instead of a simple 100msec wait,
use a timer (I assume these packets are sending updates about game state to the
client), for each update, if the last one has been sent less then,
say, 50msec ago, then don't send the
packet, but if more, then send (without a pause)
This means the system updates without any delay, but there is a
maximum rate of packets
being sent to avoid overloading the recipients buffer.
I wouldn't try to have the code figure out WAN versus LAN, there are
so many different network
configurations out there it is often not meaningful, plus it depends
on CPU speed as well as network
speed (you're problem is the network is too fast for the CPU)
. But maybe let users adjust this timeout value,
if they have fast computers and a fast network they may be able to lower it.

Ian




More information about the User mailing list