rbit / pydtls

Datagram Transport Layer Security for Python
Apache License 2.0
72 stars 45 forks source link

Error 505: The peer address is not reachable #19

Open matanhaller opened 6 years ago

matanhaller commented 6 years ago

I tried running the simple_client.py test that's available in the package and I get the following traceback:

DEBUG:dtls.sslconnection:Initiating handshake... DEBUG:dtls.openssl:SSL error raised: ssl_error: 5, result: -1, errqueue: [], func_name: SSL_do_handshake DEBUG:dtls.sslconnection:Freeing SSL: 98835056 DEBUG:dtls.sslconnection:Freeing SSL CTX: 92355984 Traceback (most recent call last): File "C:\Python27\Lib\site-packages\dtls\test\simple_client.py", line 11, in sock.connect(('localhost', 28000)) File "C:\Python27\lib\ssl.py", line 876, in connect self._real_connect(addr, False) File "C:\Python27\lib\site-packages\dtls\patch.py", line 272, in _SSLSocket_real_connect raise e ssl.SSLError: 505: The peer address is not reachable(5, [], -1, <CFunctionType object at 0x0000000005F83118>, (<dtls.openssl.SSL object at 0x0000000005F93470>,))

Any explanation?

Thanks in advance!

rbit commented 6 years ago

Are you running a server; one like echo_seq?

On Mon, Jan 8, 2018 at 9:14 AM, matanhaller notifications@github.com wrote:

I tried running the simple_client.py test that's available in the package and I get the following traceback:

DEBUG:dtls.sslconnection:Initiating handshake... DEBUG:dtls.openssl:SSL error raised: ssl_error: 5, result: -1, errqueue: [], func_name: SSL_do_handshake DEBUG:dtls.sslconnection:Freeing SSL: 98835056 DEBUG:dtls.sslconnection:Freeing SSL CTX: 92355984 Traceback (most recent call last): File "C:\Python27\Lib\site-packages\dtls\test\simple_client.py", line 11, in sock.connect(('localhost', 28000)) File "C:\Python27\lib\ssl.py", line 876, in connect self._real_connect(addr, False) File "C:\Python27\lib\site-packages\dtls\patch.py", line 272, in _SSLSocket_real_connect raise e ssl.SSLError: 505: The peer address is not reachable(5, [], -1, <CFunctionType object at 0x0000000005F83118>, (<dtls.openssl.SSL object at 0x0000000005F93470>,))

Any explanation?

Thanks in advance!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rbit/pydtls/issues/19, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJ_Rymwk281C-xKAYTHxaVuRMZ094ylks5tIkzwgaJpZM4RWrdh .

matanhaller commented 6 years ago

I tried running this server and it worked, but when I try building a server myself I remain with the same mistake. Here's my basic server logic:

from dtls import do_patch

do_patch()

ADDR = ('0.0.0.0', 1234)

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(ADDR) ssl_sock = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_DTLSv1_2, server_side=True, certfile='cert.pem', keyfile='key.pem')

ssl_sock.listen(5) conn, addr = ssl_sock.accept()

What's the problem with the code?