Skip to content

Instantly share code, notes, and snippets.

@zztczcx
Created May 30, 2013 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zztczcx/5676835 to your computer and use it in GitHub Desktop.
Save zztczcx/5676835 to your computer and use it in GitHub Desktop.
tls_memory
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');
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