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.
35 lines
710 B
35 lines
710 B
13 years ago
|
var common = require('../common');
|
||
|
var assert = require('assert');
|
||
|
var net = require('net');
|
||
|
|
||
13 years ago
|
var gotError = false;
|
||
13 years ago
|
var gotWriteCB = false;
|
||
13 years ago
|
|
||
|
process.on('exit', function() {
|
||
|
assert(gotError);
|
||
13 years ago
|
assert(gotWriteCB);
|
||
13 years ago
|
});
|
||
13 years ago
|
|
||
|
var server = net.createServer(function(socket) {
|
||
12 years ago
|
socket.resume();
|
||
|
|
||
13 years ago
|
socket.on('error', function(error) {
|
||
12 years ago
|
console.error('got error, closing server', error);
|
||
13 years ago
|
server.close();
|
||
|
gotError = true;
|
||
13 years ago
|
});
|
||
|
|
||
|
setTimeout(function() {
|
||
12 years ago
|
console.error('about to try to write');
|
||
13 years ago
|
socket.write('test', function(e) {
|
||
|
gotWriteCB = true;
|
||
|
});
|
||
13 years ago
|
}, 250);
|
||
|
});
|
||
|
|
||
|
server.listen(common.PORT, function() {
|
||
|
var client = net.connect(common.PORT, function() {
|
||
|
client.end();
|
||
|
});
|
||
|
});
|