mirror of https://github.com/lukechilds/node.git
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.
27 lines
718 B
27 lines
718 B
process.mixin(require("common.js"));
|
|
|
|
tcp = require("/tcp.js");
|
|
sys = require("/sys.js");
|
|
PORT = 23123;
|
|
var x = process.path.join(fixturesDir, "x.txt");
|
|
var expected = "xyz";
|
|
|
|
var server = tcp.createServer(function (socket) {
|
|
socket.addListener("receive", function (data) {
|
|
found = data;
|
|
client.close();
|
|
socket.close();
|
|
server.close();
|
|
assertEquals(expected, found);
|
|
});
|
|
});
|
|
server.listen(PORT);
|
|
|
|
var client = tcp.createConnection(PORT);
|
|
client.addListener("connect", function () {
|
|
posix.open(x,process.O_RDONLY, 0666).addCallback(function (fd) {
|
|
posix.sendfile(client.fd, fd, 0, expected.length).addCallback(function (size) {
|
|
assertEquals(expected.length, size);
|
|
});
|
|
});
|
|
});
|
|
|