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.
28 lines
701 B
28 lines
701 B
15 years ago
|
process.mixin(require("./common"));
|
||
15 years ago
|
|
||
15 years ago
|
tcp = require("tcp");
|
||
|
sys = require("sys");
|
||
15 years ago
|
PORT = 23123;
|
||
15 years ago
|
var x = path.join(fixturesDir, "x.txt");
|
||
15 years ago
|
var expected = "xyz";
|
||
|
|
||
|
var server = tcp.createServer(function (socket) {
|
||
|
socket.addListener("receive", function (data) {
|
||
|
found = data;
|
||
|
client.close();
|
||
|
socket.close();
|
||
|
server.close();
|
||
15 years ago
|
assert.equal(expected, found);
|
||
15 years ago
|
});
|
||
|
});
|
||
|
server.listen(PORT);
|
||
|
|
||
|
var client = tcp.createConnection(PORT);
|
||
|
client.addListener("connect", function () {
|
||
15 years ago
|
posix.open(x,process.O_RDONLY, 0666).addCallback(function (fd) {
|
||
15 years ago
|
posix.sendfile(client.fd, fd, 0, expected.length).addCallback(function (size) {
|
||
15 years ago
|
assert.equal(expected.length, size);
|
||
15 years ago
|
});
|
||
|
});
|
||
|
});
|