Created
May 30, 2013 09:46
-
-
Save zztczcx/5676835 to your computer and use it in GitHub Desktop.
tls_memory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tls = require('tls'); | |
var fs = require('fs'); | |
//tls.SLAB_BUFFER_SIZE = 1024*1024; | |
var options = { | |
key: fs.readFileSync('private-key.pem'), | |
cert: fs.readFileSync('public-cert.pem'), | |
rejectUnauthorized: false | |
}; | |
var i = 0; | |
tls.createServer(options, function (s) { | |
s.write("welcome!\n"); | |
console.log('got client',++i); | |
//s.pipe(s); | |
}).listen(8000); | |
console.log('127.0.0.1:8000'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tls = require('tls'); | |
var fs = require('fs'); | |
var options = { | |
// These are necessary only if using the client certificate authentication | |
key: fs.readFileSync('client-key.pem'), | |
cert: fs.readFileSync('client-cert.pem'), | |
//requestCert: true, | |
//This is necessary only if the server uses the self-signed certificate | |
//ca: [ fs.readFileSync('server-cert.pem') ] | |
rejectUnauthorized: false | |
}; | |
function go() { | |
var s = null; | |
s = tls.connect(8000, '127.0.0.1',options, function() { | |
setInterval(function() { | |
s.write('hello\n'); | |
}, 5000); | |
}); | |
}; | |
var i; | |
for (i = 0; i<2000; i++) { | |
go(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment