Some question about creating DataConnection, when exists NAT.
 
In the following sence , it happen some wrong when creating DataConnection .
 
Sence:
ftp server Listening at inner ip : 10.1.100.34  port 21
ftp client is behind the firewall , ftpServer inner ip through NAT is 
192.168.2.1. 
 
in the ftp client’s command console: 
ftp  192.168.2.1   
user:xxxx
pass:xxxx
can connected
 
passive 
return: entering passive mode ( 10.1.00.34 port)
ftpserver return inner ip ,not after NAT ip(192.168.2.1)
 
client can’t connect inner ip, so connection is time out.
 
Because , ftpserver return’s message is ISO seventh layer datagram, router 
device just convert IP layer datagram.
 
Modify some class to solve the problem:
 
1.       SocketClient class 
Add  var : private String _set_passive_host_ip 
In  connect method :
 add:   _set_passive_host_ip = hostname; 
 
2.       FTPClient class 
In __parsePassiveModeReply method:
 Add:  __passiveHost = _set_passive_host_ip; 
 
Use connect method parameter “hostname” as dataconnection “ip”. 

Reply via email to