FTP Port IP address

  • Thread starter Thread starter Keith M.
  • Start date Start date
K

Keith M.

I use a Socket to send the FTP Commands to the Host and
the localendpoint gives me an address of 127.0.0.1, which
is fine but when I send the PORT command I need a new IP
address. That is where my problem is. If i create a new
Socket it still has the same IP address 127.0.0.1. When I
use the commercial client SmartFTP it uses the same
address 127.0.0.1 for the FTP commands and 192.168.0.2 for
the port command. How with .net can I get this IP address?
 
Are you using non-passive mode ? If so, you need to create an accepting
socket, get its local endpoint, and then send that IP to the server.
Socket.LocalEndPOint will give you the local ip.

If you are using passive mode, then you shoul send the "PASV" command to the
servre, the server will open a accepting socket and send you the endpoint.
 
Back
Top