Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Oct : Re: TIdTrivialFTPServer and multi-homed server?

www.cryer.info
Managed Newsgroup Archive

Re: TIdTrivialFTPServer and multi-homed server?

Subject:Re: TIdTrivialFTPServer and multi-homed server?
Posted by:"Philippe Auphelle" (pauphelle.no.spam.please@wanadoo.fr)
Date:Fri, 13 Oct 2006 08:59:07

Gambit,

>>      // For each of our IP addresses, create and init a binding.
>>      for i := 0 to GStack.LocalAddresses.Count - 1 do
>>        with Bindings.Add do
>>          begin
>>          IP := GStack.LocalAddresses[i];
>
> I explained to you earlier about the danger of accessing
> the LocalAddresses property over and over like that.

You must be kidding:
On Thu, 10 Oct 2006, 11:26:21 - 0700, you wrote *exactly* this:

<Quote>

You do not need to index into the Bindings like that.  Add() returns the
necessary TIdSocketHandle object pointer.

  with Bindings.Add do
  begin
    IP := GStack.LocalAddresses[i];
    Log.Write(LLNormal, 'Created binding ' + IP + ':' + IntToStr(Port));
    end;

</Quote>

This is precisely the code sequence that I copied (and that I thanked
you for in a follow-up message).
And now, you are qualifying it as a "danger", pointing at it as the
probable cause of the problem?

Come on, I sent you a full example of code in my previous message, with
overdetailed explanations about what it does and doesn't do when ran.
If you mean to help, and really see what the problem is, wouldn't it be
more productive to simply copy and paste the part of the code that you
think is wrong, and change it to what you think will work? /Ph.


Remy Lebeau (TeamB) wrote:
> "Philippe Auphelle" <pauphelle.No.Spam.Please@wanadoo.fr> wrote in message
> news:452e1a2b@newsgroups.borland.com...
>
>> After fixing in yesterday's snapshot the couple of lines that don't
> compile,
>> I used the snapshot Indy, recompiled my app, and surprise! It *does*
>> work with two IPs, *without* changing anything else in my own code.
>
> As it should be.
>
>> Once again, I have no doubt that TidUDPServer has been *designed*
>> to support multi-homing for years, but the hard fact is that the version I
>> used of a stable 10.1.5 as of today does *not* seem to work properly
>> on a multi-homed config.
>
> Yes, it does.  TIdUDPServer has been using the same multi-homed architecture
> for years that has worked fine.  The re-write done 11 months ago was merely
> to optimize that better so that the OnUDPRead events triggered on multiple
> items in the Bindings collection are not serialized anymore, which they
> always were due to the single listener thread looping through the Bindings
> one at a time.  But the Bindings themselves still work the same as they
> always have.
>
>>      // For each of our IP addresses, create and init a binding.
>>      for i := 0 to GStack.LocalAddresses.Count - 1 do
>>        with Bindings.Add do
>>          begin
>>          IP := GStack.LocalAddresses[i];
>
> I explained to you earlier about the danger of accessing the LocalAddresses
> property over and over like that.
>
>
> Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive