title: Error after FTPS transfer finishes with Python ftplib
body: <p>I'm trying to upload file into FTPS server (Wing FTP Server / Cerberus FTP Server 8) with following script.</p>
  <pre><code>from ftplib import FTP_TLS
  ftps = FTP_TLS('192.168.133.69')
  ftps.login('1011', '7c52xK9')      
  ftps.prot_p()
  filename = 'upload.pdf'
  myfile = open(filename, 'rb')
  ftps.storbinary('STOR %s' % filename, myfile)
  myfile.close()
  ftps.close()
  </code></pre>
  <p>But I keep getting this error.</p>
  <pre class="lang-none prettyprint-override"><code>line 7, in &lt;module&gt;
      ftps.storbinary('STOR %s' % filename, myfile)
    File &quot;C:\Python27\lib\ftplib.py&quot;, line 769, in storbinary
      conn.unwrap()
    File &quot;C:\Python27\lib\ssl.py&quot;, line 823, in unwrap
      s = self._sslobj.shutdown()
  error: [Errno 0] Error
  </code></pre>
  <p>This is FTPS server log.</p>
  <pre class="lang-none prettyprint-override"><code>[04] Thu, 02 Feb 2017 19:41:23 (0000062) 220 Wing FTP Server ready... (UNREGISTERED WING FTP SERVER)
  [03] Thu, 02 Feb 2017 19:41:23 (0000062) AUTH TLS
  [04] Thu, 02 Feb 2017 19:41:23 (0000062) 234 AUTH command OK. Initializing TLS connection.
  [03] Thu, 02 Feb 2017 19:41:23 (0000062) USER 1011
  [04] Thu, 02 Feb 2017 19:41:23 (0000062) 331 Password required for 1011
  [03] Thu, 02 Feb 2017 19:41:23 (0000062) PASS **********
  [04] Thu, 02 Feb 2017 19:41:23 (0000062) 230 User 1011 logged in.
  [03] Thu, 02 Feb 2017 19:41:23 (0000062) PBSZ 0
  [04] Thu, 02 Feb 2017 19:41:23 (0000062) 200 Command okay. PBSZ=0.
  [03] Thu, 02 Feb 2017 19:41:23 (0000062) PROT P
  [04] Thu, 02 Feb 2017 19:41:23 (0000062) 200 Encrypting Data Channel.
  [03] Thu, 02 Feb 2017 19:41:23 (0000062) TYPE I
  [04] Thu, 02 Feb 2017 19:41:23 (0000062) 200 Type set to I
  [03] Thu, 02 Feb 2017 19:41:23 (0000062) PASV
  [04] Thu, 02 Feb 2017 19:41:23 (0000062) 227 Entering Passive Mode (192,168,133,69,4,21)
  [03] Thu, 02 Feb 2017 19:41:23 (0000062) STOR upload.pdf
  [04] Thu, 02 Feb 2017 19:41:23 (0000062) 150 Opening BINARY mode data connection for file transfer.
  [04] Thu, 02 Feb 2017 19:41:23 (0000062) 226 File received successful. Transferred:0Bytes;Average speed is:0.000KB/s
  </code></pre>
  <p>Can anyone tell me what is wrong?!!</p>
  <p>PS: I don't know it matters or not but i can easily download from this FTPS server and only cant upload into it.</p>
  <p>Thanks in advance</p>
  <hr />
  <p>I tried with FileZilla as &quot;Martin Prikryl&quot; suggested and now I have following error.</p>
  <pre class="lang-none prettyprint-override"><code>line 7, in &lt;module&gt;
      ftps.storbinary('STOR %s' % filename, myfile)
    File &quot;C:\Python27\lib\ftplib.py&quot;, line 760, in storbinary
      conn = self.transfercmd(cmd, rest)
    File &quot;C:\Python27\lib\ftplib.py&quot;, line 376, in transfercmd
      return self.ntransfercmd(cmd, rest)[0]
    File &quot;C:\Python27\lib\ftplib.py&quot;, line 713, in ntransfercmd
      server_hostname=self.host)
    File &quot;C:\Python27\lib\ssl.py&quot;, line 363, in wrap_socket
      _context=self)
    File &quot;C:\Python27\lib\ssl.py&quot;, line 611, in __init__
      self.do_handshake()
    File &quot;C:\Python27\lib\ssl.py&quot;, line 840, in do_handshake
      self._sslobj.do_handshake()
  SSLEOFError: EOF occurred in violation of protocol (_ssl.c:661)
  </code></pre>
  <p>This is FileZilla server Log.</p>
  <pre class="lang-none prettyprint-override"><code>(000002)2017/02/03 11:00:54 ق.ظ - (not logged in) (127.0.0.1)&gt; Connected on port 21, sending welcome message...
  (000002)2017/02/03 11:00:54 ق.ظ - (not logged in) (127.0.0.1)&gt; 220-FileZilla Server 0.9.59 beta
  (000002)2017/02/03 11:00:54 ق.ظ - (not logged in) (127.0.0.1)&gt; 220-written by Tim Kosse (tim.kosse@filezilla-project.org)
  (000002)2017/02/03 11:00:54 ق.ظ - (not logged in) (127.0.0.1)&gt; 220 Please visit https://filezilla-project.org/
  (000002)2017/02/03 11:00:54 ق.ظ - (not logged in) (127.0.0.1)&gt; AUTH TLS
  (000002)2017/02/03 11:00:54 ق.ظ - (not logged in) (127.0.0.1)&gt; 234 Using authentication type TLS
  (000002)2017/02/03 11:00:54 ق.ظ - (not logged in) (127.0.0.1)&gt; TLS connection established
  (000002)2017/02/03 11:00:54 ق.ظ - (not logged in) (127.0.0.1)&gt; USER 1011
  (000002)2017/02/03 11:00:54 ق.ظ - (not logged in) (127.0.0.1)&gt; 331 Password required for 1011
  (000002)2017/02/03 11:00:54 ق.ظ - (not logged in) (127.0.0.1)&gt; PASS *******
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; 230 Logged on
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; PBSZ 0
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; 200 PBSZ=0
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; PROT P
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; 200 Protection level set to P
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; TYPE I
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; 200 Type set to I
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; PASV
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; 227 Entering Passive Mode (127,0,0,1,231,157)
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; STOR upload.pdf
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; 150 Opening data channel for file upload to server of &quot;/upload.pdf&quot;
  (000002)2017/02/03 11:00:54 ق.ظ - 1011 (127.0.0.1)&gt; 450 TLS session of data connection has not resumed or the session does not match the control connection
  (000002)2017/02/03 11:02:54 ق.ظ - 1011 (127.0.0.1)&gt; 421 Connection timed out.
  (000002)2017/02/03 11:02:54 ق.ظ - 1011 (127.0.0.1)&gt; disconnected.
  </code></pre>