Skip to content

Instantly share code, notes, and snippets.

@marlun
Created March 5, 2012 22:44
Show Gist options
  • Select an option

  • Save marlun/1981698 to your computer and use it in GitHub Desktop.

Select an option

Save marlun/1981698 to your computer and use it in GitHub Desktop.
Client
var fs = require('fs')
var tls = require('tls')
var options = {
cert: fs.readFileSync('cert.pem'),
passphrase: 'passphrase'
}
var stream = tls.connect(700, 'hostname.com', options);
stream.setEncoding('utf8')
stream.on('secureConnect', function() {
console.log('client connected')
})
stream.on('data', function(data) {
console.log(data)
})
events.js:48
throw arguments[1]; // Unhandled 'error' event
^
Error: socket hang up
at SecurePair.error (tls.js:802:15)
at EncryptedStream._done (tls.js:283:17)
at EncryptedStream._pull (tls.js:426:12)
at SecurePair.cycle (tls.js:720:20)
at EncryptedStream.end (tls.js:256:13)
at Socket.onend (stream.js:80:10)
at Socket.emit (events.js:88:20)
at TCP.onread (net.js:368:51)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment