🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
3 messages
3 total messages Started by David Perkins Wed, 19 Sep 2007 12:14
TIdFTPServer, passive mode behind NAT
#822
Author: David Perkins
Date: Wed, 19 Sep 2007 12:14
28 lines
1636 bytes
I have a small app that uses TIdFTPServer with no bindings.  It's behind 
NAT on IP 192.168.1.5.  I've forwarded ports 20/21.

I'm trying to use passive mode to connect to the server from an external 
IP, but it fails.  The external connection is told to connect to 
192.168.1.5,20 which it cannot.

So, I have overridden OnPASV and assigned:

   VIP = "a.b.c.d";
   VPort = m_pFtpServer->DefaultDataPort;

Where a.b.c.d is my router IP (WAN) address.  When I then attempt to 
connect I get an error: "550 Cannot assign requested address."


Q. Any idea why this error occurs?

Q. If I do not assign the VPort, would one be assigned by default?  How 
would I specify a range of Ports it could choose from - by modifying a 
TIdSocketHandle.ClientPortMax/Min?


Using BCB2006, Indy v9

Thanks

David
Re: TIdFTPServer, passive mode behind NAT
#823
Author: Remy Lebeau (TeamB)
Date: Wed, 19 Sep 2007 17:44
28 lines
1878 bytes
"David Perkins" <please@no-spam.com> wrote in message
news:46f11284$1@newsgroups.borland.com...

> Any idea why this error occurs?

When the OnPASV event handler exists, TIdFTPServer tries to bind a listening
socket to the IP that you specified.  Since the IP is not local to the
machine you are running on, the binding fails.

Indy 9 does not support what you are attempting.  Unless you don't mind
hacking Indy's source code, then you will need to upgrade to Indy 10.
TIdFTPServer has a new OnPASVReply event that you would need to use in order
to customize the IP/Port that is sent back to the client.  Don't use the
OnPASV event for that anymore.

> If I do not assign the VPort, would one be assigned by default?

Yes, using the same property that you are using manually.

> How would I specify a range of Ports it could choose from

In Indy 9, you don't.  Again, you would have to upgrade to Indy 10.
TIdFTPServer has new PASVBoundPortMin and PASVBoundPortMax properties that
you can use for that.


Gambit
Re: TIdFTPServer, passive mode behind NAT
#824
Author: David Perkins
Date: Thu, 20 Sep 2007 09:10
1 lines
967 bytes
Thanks, Indy 10 it is then.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads