Rantanen / node-dtls

JavaScript DTLS implementation for Node.js
ISC License
58 stars 15 forks source link

Check to see if socket is still connected #20

Open ahadcove opened 5 years ago

ahadcove commented 5 years ago

I'm running into two issues: One is where the handshake times out

  Error: The DTLS handshake timed out
    at Socket../node_modules/node-dtls/build/dtls.js.Socket.expectHandshake (dtls.js:160)
    at dtls.js:117

So after that error happens I have it in my code to wait 10 seconds and then retry. So when it retries it get's a connections, but the thing is is that it says the socket is closed. I don't see any where to actually check if the socket is opened or not. I guess I need to add somewhere in my class to keep the event listeners after the initial connection, but is there anyway to check on the object?

(Error): The socket is closed. Cannot send data.