Click here to Skip to main content
15,918,516 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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(, is set by NAT), and the other is private IP(, the true IP). So I must connect the Server use public internet IP( But in FTP protocol processing, the server will return the server IP(, 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 -> IP= PORT=21
[08:31:04] [R] Connected to
[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: 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)

1 solution

This sounds like a network configuration error.

The hardware layer should appear transparent to the software.

I suggest you check the routers port forwarding etc.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900