[EMAIL PROTECTED] writes:
> On Fri, Jul 21, 2000 at 03:10:58PM -0500, Austad, Jay wrote:
> > Instead of having qmqpc picking the first available server, I would like it
> > to load balance between all servers I have listed as QMQP servers.
...
> > This way, "i" will be a random number from 0 to (servers.len-1).
>
> Almost. Note that 'i' has to point to the start of the \0 terminated
> string that 'j' is currently scanning. servers.s is a series of \0
> terminated strings. You need to do some work to make sure that i, is
> pointing that the start of the string that j randomizes into.
Also note that if you choose one at random every time, you just might
choose the same one, which happens to be down, every time. It'd be
better to rotate the list by a random number of entries, and then step
through it normally.
paul