I want to write a program in C# to connect a FTP Server locate another company and download some files. The FTP Server is setup with SSL and NAT. It has 2 IP. One is public internet IP(220.166.51.10, is set by NAT), and the other is private IP(192.168.10.100, the true IP). So I must connect the Server use public internet IP(220.166.51.10). But in FTP protocol processing, the server will return the server IP(192.168.10.100), they are different, so the client will think the server is wrong. What is the solution?
the FTP protocol process: (the underline text)
[08:30:58] WinSock 2.0 -- OpenSSL 0.9.8i 15 Sep 2008
[08:31:04] [R] Connecting to 220.166.51.10 -> IP=220.166.51.10 PORT=21
[08:31:04] [R] Connected to 220.166.51.10
[08:31:04] [R] 220 (vsFTPd 2.0.5)
[08:31:04] [R] AUTH SSL
[08:31:04] [R] 234 Proceed with negotiation.
[08:31:04] [R] Connected. Negotiating SSL session..
[08:31:04] [R] SSL negotiation successful...
[08:31:04] [R] SSL encrypted session using cipher DES-CBC3-SHA (168 bits)
[08:31:04] [R] PBSZ 0
[08:31:04] [R] 200 PBSZ set to 0.
[08:31:04] [R] USER z29
[08:31:04] [R] 331 Please specify the password.
[08:31:04] [R] PASS (hidden)
[08:31:05] [R] 230 Login successful.
[08:31:05] [R] SYST
[08:31:05] [R] 215 UNIX Type: L8
[08:31:05] [R] FEAT
[08:31:05] [R] 211-Features:
[08:31:05] [R] AUTH SSL
[08:31:05] [R] AUTH TLS
[08:31:05] [R] EPSV
[08:31:05] [R] MDTM
[08:31:05] [R] PASV
[08:31:05] [R] PBSZ
[08:31:05] [R] PROT
[08:31:05] [R] REST STREAM
[08:31:05] [R] SIZE
[08:31:05] [R] TVFS
[08:31:05] [R] 211 End
[08:31:05] [R] PWD
[08:31:05] [R] 257 "/u01/z29"
[08:31:05] [R] TYPE A
[08:31:05] [R] 200 Switching to ASCII mode.
[08:31:05] [R] PROT P
[08:31:05] [R] 200 PROT now Private.
[08:31:05] [R] PASV
[08:31:05] [R] 227 Entering Passive Mode (192,168,10,100,234,96)
[08:31:05] [R] Opening data connection IP: 220.166.51.10 PORT: 60000
[08:31:05] [R] LIST -al
[08:31:05] [R] Connected. Negotiating SSL session..
[08:31:05] [R] 150 Here comes the directory listing.
[08:31:05] [R] SSL negotiation successful...
[08:31:05] [R] SSL encrypted session using cipher DES-CBC3-SHA (168 bits)
[08:31:05] [R] 226 Directory send OK.
[08:31:05] [R] List Complete: 1 KB in 0.47 seconds (2.2 KB/s)