mirror of https://github.com/lukechilds/node.git
Connor Dunn
15 years ago
committed by
Ryan Dahl
3 changed files with 50 additions and 0 deletions
@ -0,0 +1,27 @@ |
|||
node.mixin(require("common.js")); |
|||
|
|||
tcp = require("/tcp.js"); |
|||
sys = require("/sys.js"); |
|||
PORT = 23123; |
|||
var x = node.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 () { |
|||
node.fs.open(x,node.O_RDONLY, 0666).addCallback(function (fd) { |
|||
node.fs.sendfile(client.fd, fd, 0, expected.length).addCallback(function (size) { |
|||
assertEquals(expected.length, size); |
|||
}); |
|||
}); |
|||
}); |
Loading…
Reference in new issue