SSL - Timed out trying to read data from the socket stream!

Apr 16, 2014 at 1:33 PM
I'm tring to create\edit file in the server. I'm using SSL\TLS while communicating with the server.
This is my init code:
        public PageDownloader()
        {
            this.Client = new FtpClient()
            {
                Host = FTP_HOST,
                Credentials = new NetworkCredential(FTP_USER, FTP_PASS),
                EncryptionMode = FtpEncryptionMode.Explicit,
            };
            this.Client.ValidateCertificate += Client_ValidateCertificate;
            this.Client.Connect();
        }

        void Client_ValidateCertificate(FtpClient control, FtpSslValidationEventArgs e)
        {
            e.Accept = true; // TODO: Check the certificate.
        }
Until here- every thing is working good.

When I'm trying to OpenWrite, something like this:
using (Stream fs = this.Client.OpenWrite(PATH))
{
     // ... Just enter this block and leave - no more executing.
} // <----- Exception thrown here!
It's failed:
System.TimeoutException: Timed out trying to read data from the socket stream!
   at System.Net.FtpClient.FtpSocketStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.Net.FtpClient.FtpSocketStream.ReadLine(Encoding encoding)
   at System.Net.FtpClient.FtpClient.GetReply()
   at System.Net.FtpClient.FtpClient.CloseDataStream(FtpDataStream stream)
   at System.Net.FtpClient.FtpDataStream.Close()
   at System.Net.FtpClient.FtpSocketStream.Dispose()
In file zilla it's working good.

Activated FtpTrace:
220 (vsFTPd 3.0.2)
AUTH TLS
234 Proceed with negotiation.
Time to activate encryption: 0h 0m 0s, Total Seconds: 0.2219123.
USER *******
331 Please specify the password.
PASS <omitted>
230 Login successful.
PBSZ 0
200 PBSZ set to 0.
PROT P
200 PROT now Private.
FEAT
211-Features:
 AUTH SSL
 AUTH TLS
 EPRT
 EPSV
 MDTM
 PASV
 PBSZ
 PROT
 REST STREAM
 SIZE
 TVFS
 UTF8
211 End
OPTS UTF8 ON
200 Always in UTF8 mode.
Text encoding: System.Text.UTF8Encoding
220 (vsFTPd 3.0.2)
AUTH TLS
234 Proceed with negotiation.
Time to activate encryption: 0h 0m 0s, Total Seconds: 0.1644478.
USER *******
331 Please specify the password.
PASS <omitted>
230 Login successful.
PBSZ 0
200 PBSZ set to 0.
PROT P
200 PROT now Private.
Text encoding: System.Text.UTF8Encoding
PWD
257 "/home/*******"
CWD /home/*******
250 Directory successfully changed.
TYPE I
200 Switching to Binary mode.
SIZE /home/*******/test.txt
213 0
EPSV
229 Entering Extended Passive Mode (|||4243|).
STOR /home/*******/test.txt
Disposing FtpClient object... 
// ############################################# BOOM - Here is the timeout!!!
Testing connectivity using Socket.Poll()...
Testing connectivity using Socket.Poll()...
Testing connectivity using Socket.Poll()...
QUIT
221 Goodbye.
Disposing FtpSocketStream...
I'm tryed to run this exact code, without SSL\TLS layer, and it's working.

What could be the problem?
Thank you!