|
|
@ -24,9 +24,9 @@ exports.createServer = function() { |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
exports.connect = exports.createConnection = function(port, host /* [cb] */ ) { |
|
|
|
exports.connect = exports.createConnection = function(port /* [host], [cb] */) { |
|
|
|
var s = new Socket(); |
|
|
|
s.connect(port, host, arguments[2]); |
|
|
|
s.connect(port, arguments[1], arguments[2]); |
|
|
|
return s; |
|
|
|
}; |
|
|
|
|
|
|
@ -340,7 +340,7 @@ function connectip(self, port, ip) { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Socket.prototype.connect = function(port, host /* [cb] */) { |
|
|
|
Socket.prototype.connect = function(port /* [host], [cb] */) { |
|
|
|
var self = this; |
|
|
|
|
|
|
|
if (this.destroyed) { |
|
|
@ -348,9 +348,15 @@ Socket.prototype.connect = function(port, host /* [cb] */) { |
|
|
|
initSocketHandle(this); |
|
|
|
} |
|
|
|
|
|
|
|
var host; |
|
|
|
if (typeof arguments[1] === 'function') { |
|
|
|
self.on('connect', arguments[1]); |
|
|
|
} else { |
|
|
|
host = arguments[1]; |
|
|
|
if (typeof arguments[2] === 'function') { |
|
|
|
self.on('connect', arguments[2]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
timers.active(this); |
|
|
|
|
|
|
|