|
@ -1,5 +1,7 @@ |
|
|
var sys = require("sys"); |
|
|
var sys = require("sys"); |
|
|
var fs = require("fs"); |
|
|
var fs = require("fs"); |
|
|
|
|
|
var events = require("events"); |
|
|
|
|
|
|
|
|
var debugLevel = 0; |
|
|
var debugLevel = 0; |
|
|
if ('NODE_DEBUG' in process.ENV) debugLevel = 1; |
|
|
if ('NODE_DEBUG' in process.ENV) debugLevel = 1; |
|
|
function debug (x) { |
|
|
function debug (x) { |
|
@ -8,30 +10,33 @@ function debug (x) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var binding = process.binding('net'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Buffer = process.Buffer; |
|
|
var Buffer = process.Buffer; |
|
|
var IOWatcher = process.IOWatcher; |
|
|
var IOWatcher = process.IOWatcher; |
|
|
var assert = process.assert; |
|
|
var assert = process.assert; |
|
|
var socket = process.socket; |
|
|
|
|
|
var bind = process.bind; |
|
|
var socket = binding.socket; |
|
|
var connect = process.connect; |
|
|
var bind = binding.bind; |
|
|
var listen = process.listen; |
|
|
var connect = binding.connect; |
|
|
var accept = process.accept; |
|
|
var listen = binding.listen; |
|
|
var close = process.close; |
|
|
var accept = binding.accept; |
|
|
var shutdown = process.shutdown; |
|
|
var close = binding.close; |
|
|
var read = process.read; |
|
|
var shutdown = binding.shutdown; |
|
|
var recvMsg = process.recvMsg; |
|
|
var read = binding.read; |
|
|
var sendFD = process.sendFD; |
|
|
var recvMsg = binding.recvMsg; |
|
|
var write = process.write; |
|
|
var sendFD = binding.sendFD; |
|
|
var toRead = process.toRead; |
|
|
var write = binding.write; |
|
|
var setNoDelay = process.setNoDelay; |
|
|
var toRead = binding.toRead; |
|
|
var socketError = process.socketError; |
|
|
var setNoDelay = binding.setNoDelay; |
|
|
var getsockname = process.getsockname; |
|
|
var socketError = binding.socketError; |
|
|
var getaddrinfo = process.getaddrinfo; |
|
|
var getsockname = binding.getsockname; |
|
|
var needsLookup = process.needsLookup; |
|
|
var getaddrinfo = binding.getaddrinfo; |
|
|
var errnoException = process.errnoException; |
|
|
var needsLookup = binding.needsLookup; |
|
|
var EINPROGRESS = process.EINPROGRESS; |
|
|
var errnoException = binding.errnoException; |
|
|
var ENOENT = process.ENOENT; |
|
|
var EINPROGRESS = binding.EINPROGRESS; |
|
|
|
|
|
var ENOENT = binding.ENOENT; |
|
|
var END_OF_FILE = 0; |
|
|
var END_OF_FILE = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -357,7 +362,7 @@ function initSocket (self) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function Socket (fd) { |
|
|
function Socket (fd) { |
|
|
process.EventEmitter.call(this); |
|
|
events.EventEmitter.call(this); |
|
|
|
|
|
|
|
|
this.fd = null; |
|
|
this.fd = null; |
|
|
|
|
|
|
|
@ -372,7 +377,7 @@ function Socket (fd) { |
|
|
this.writable = true; |
|
|
this.writable = true; |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
sys.inherits(Socket, process.EventEmitter); |
|
|
sys.inherits(Socket, events.EventEmitter); |
|
|
exports.Socket = Socket; |
|
|
exports.Socket = Socket; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -750,7 +755,7 @@ Socket.prototype.close = function () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Server (listener) { |
|
|
function Server (listener) { |
|
|
process.EventEmitter.call(this); |
|
|
events.EventEmitter.call(this); |
|
|
var self = this; |
|
|
var self = this; |
|
|
|
|
|
|
|
|
if (listener) { |
|
|
if (listener) { |
|
@ -778,7 +783,7 @@ function Server (listener) { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
sys.inherits(Server, process.EventEmitter); |
|
|
sys.inherits(Server, events.EventEmitter); |
|
|
exports.Server = Server; |
|
|
exports.Server = Server; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|