You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.0 KiB

common = require("../common");
assert = common.assert
15 years ago
net = require("net");
fs = require("fs");
util = require("util");
15 years ago
path = require("path");
fn = path.join(common.fixturesDir, 'elipses.txt');
15 years ago
expected = fs.readFileSync(fn, 'utf8');
server = net.createServer(function (stream) {
common.error('pump!');
util.pump(fs.createReadStream(fn), stream, function () {
common.error('server stream close');
common.error('server close');
15 years ago
server.close();
});
});
server.listen(common.PORT, function () {
conn = net.createConnection(common.PORT);
15 years ago
conn.setEncoding('utf8');
conn.addListener("data", function (chunk) {
common.error('recv data! nchars = ' + chunk.length);
15 years ago
buffer += chunk;
});
conn.addListener("end", function () {
conn.end();
});
conn.addListener("close", function () {
common.error('client connection close');
15 years ago
});
});
var buffer = '';
count = 0;
server.addListener('listening', function () {
});
process.addListener('exit', function () {
assert.equal(expected, buffer);
});