by mrb · 16y ago · 0 comments
var net = require('net');
var server = net.createServer(function (stream) {
stream.on('connect', function () {});
stream.on('data', function (data) {
var l = data.length;
if (l >= 4 && data[l - 4] == 0xd && data [l - 3] == 0xa && data[l - 2] == 0xd && data[l - 1] == 0xa) {
stream.write('HTTP/1.0 200 OK\r\nConnection: Keep-Alive\r\nContent-Type: text/html\r\nContent-Length: 13\r\n\r\nHello World\r\n');
}
});
stream.on('end', function () {stream.end();});
});
server.listen(8124, 'localhost'); var net = require('net');
var server = net.createServer(function (stream) {
stream.on('connect', function () {});
stream.on('data', function (data) {
stream.write('HTTP/1.0 200 OK\r\nConnection: Keep-Alive\r\nContent-Type: text/html\r\nContent-Length: 13\r\n\r\nHello World\r\n');
});
stream.on('end', function () {stream.end();});
});
server.listen(8124, 'localhost');We are getting closer to open sourcing SXELua :-) It would be great if we could think up a better benchmark then the "Hello World" benchmark :-) What do you think about the suggestion described higher up in this thread?