Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Oct : TIdTrivialFTPServer and multi-homed server?
| Subject: | TIdTrivialFTPServer and multi-homed server? |
| Posted by: | "Philippe Auphelle" (pauphelle.no.spam.please@wanadoo.fr) |
| Date: | Mon, 9 Oct 2006 18:49:01 |
Hi,
I'm trying to get TIdTrivialFTPServer to work in a multi-homed environment.
The application itself is really is as trivial as the protocol, as
TIdTrivialFTPServer does most of the job. So most of the code is in the
OnReadFile (and that ain't much).
That's fine and dandy, and works great when I have a single IP address
on the machine.
But as soon as I have two active IP addresses, I never get control in
the OnReadFile routine anymore. Consistently, a lan analyzer session
shows that the station gets the TFTP query packets, but never answers
anything, on any interface.
At init time, just before I set Active to true, I create bindings to the
local IPs, enumerating GStack.LocalAddresses: For each LocalAddress, I
do a Bindings.Add, allocate an Id_SOCK_DGRAM, Id_IPPROTO_UDP handle, set
the SocketHandle.IP to its own local address (the port is the default
one in the server object) and I call Bind().
I go to the same loop / logic whether there is one IP or several, and
when there are several, I can see that I create the right number of
bindings.
But still, when there is more than one IP, no OnReadFile event and thus
no answer.
I don't see any way in OnReadFile to link the incoming binding to the
sender of the incoming packet, and I assume this is by design: the UDP
server knows the binding that accepted the packet, and the IP of the
caller. And again, that doesn't prevent Indy from entering the
OnReadFile event and answering when there's only one IP around.
I didn't find any mention of anything else (but the use of Bindings) in
the help file. Still, the presence of the Bindings property and
GStack.LocalAddresses clearly indicates that the multi-homing situation
has not been overlooked in Indy.
Am I forgetting something obvious?
Thanks in advance, /Ph.