I have tried to run this code with Python 3.8.10 in Ubuntu 20.04
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))
But I got an error:
Traceback (most recent call last):
File "error.py", line 8, in <module>
socket.connect(('192.168.1.111', 8080))
File "/usr/lib/python3.8/ssl.py", line 1342, in connect
self._real_connect(addr, False)
File "/usr/lib/python3.8/ssl.py", line 1333, in _real_connect
self.do_handshake()
File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1131)
I have tried all the solutions in that post but no answer was help me
I run:
from urllib.request import urlopen
urlopen('https://www.howsmyssl.com/a/check').read()
and got tls_version":"TLS 1.3
How can I fix that?