title: ssl.SSLEOFError: EOF occurred in violation of protocol
body: <p>I have tried to run this code with <code>Python 3.8.10</code> in Ubuntu 20.04</p>
  <pre><code>import socket
  import ssl
  
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  sock.settimeout(10)
  socket = ssl.wrap_socket(sock)
  
  socket.connect(('192.168.1.111', 8080))
  </code></pre>
  <p>But I got an error:</p>
  <pre><code>Traceback (most recent call last):                                    
    File &quot;error.py&quot;, line 8, in &lt;module&gt;                                
      socket.connect(('192.168.1.111', 8080))                           
    File &quot;/usr/lib/python3.8/ssl.py&quot;, line 1342, in connect             
      self._real_connect(addr, False)                                   
    File &quot;/usr/lib/python3.8/ssl.py&quot;, line 1333, in _real_connect   
      self.do_handshake()                                           
    File &quot;/usr/lib/python3.8/ssl.py&quot;, line 1309, in do_handshake    
      self._sslobj.do_handshake()                                       
  ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1131)
  </code></pre>
  <p>I have tried all the solutions in that <a href="https://stackoverflow.com/questions/33410577/python-requests-exceptions-sslerror-eof-occurred-in-violation-of-protocol">post</a> but no answer was help me</p>
  <p>I run:</p>
  <pre><code>from urllib.request import urlopen
  urlopen('https://www.howsmyssl.com/a/check').read()
  </code></pre>
  <p>and got <code>tls_version&quot;:&quot;TLS 1.3</code></p>
  <p>How can I fix that?</p>