Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Oct : Re: TIdTrivialFTPServer and multi-homed server?
| Subject: | Re: TIdTrivialFTPServer and multi-homed server? |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Tue, 10 Oct 2006 11:26:21 |
"Philippe Auphelle" <pauphelle.No.Spam.Please@wanadoo.fr> wrote in message
news:452B6981.6060805@wanadoo.fr...
> for i := 0 to GStack.LocalAddresses.Count - 1 do
I *strongly* recommand NOT using the LocalAddresses like that. Every time
the property is accessed, the list is re-populated. So you have a potential
for the list to change dynamically while you are still looping through it.
That is why the example I gave you earlier was storing the returned TStrings
pointer into a separate variable so that the property is accessed only once.
> Bindings.Add;
> Bindings[i].IP := GStack.LocalAddresses[i];
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;
> Now unfortunately, that doesn't solve the issue, that is that the
> server never enters the OnFileRead event (and doesn't send any
> reply on any NIC) when
> 1) there is more than one local IP address and
> 2) it receives a TFTP read file query on any interface.
Then there has to be something else happening. Either the UDP packets are
not being sent to the correct IP/Port to begin with, or they are being
blocked along the way. Is your server running behind a firewall or router?
The Trivial FTP protocol is UDP-based, which makes it harder to pass through
routers/firewalls, as they normally disable UDP forwarding by default.
> When there is more than one IP, the server still goes active, doesn't
> throw any error or exception, but the OnReadFile event is never gets
> called and the TFTP server doesn't seem to do anything.
Did you verify that the ports are being opened properly and are actually in
a listening mode? Use the OS's NETSTAT command-line utility to view the
active socket states.
> The Indy 10 version I use seems to be the latest (it says 10.1.5
> in iDVers.inc).
When was the last time you downloaded it, though? The snapshot has been
10.1.5 for a long time now, but has received many updates.
Gambit