|
|
@ -69,6 +69,11 @@ function initSocketHandle(self) { |
|
|
|
if (self._handle) { |
|
|
|
self._handle.socket = self; |
|
|
|
self._handle.onread = onread; |
|
|
|
|
|
|
|
var sockname = self._handle.getsockname(); |
|
|
|
self.remoteAddress = sockname.address; |
|
|
|
self.remotePort = sockname.port; |
|
|
|
// also export sockname.family?
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -464,7 +469,13 @@ Socket.prototype.connect = function(port /* [host], [cb] */) { |
|
|
|
} else { |
|
|
|
timers.active(self); |
|
|
|
|
|
|
|
connect(self, ip || '127.0.0.1', port, ip ? addressType : 4); |
|
|
|
addressType = addressType || 4; |
|
|
|
|
|
|
|
// node_net.cc handles null host names graciously but user land
|
|
|
|
// expects remoteAddress to have a meaningful value
|
|
|
|
ip = ip || (addressType === 4 ? '127.0.0.1' : '0:0:0:0:0:0:0:1'); |
|
|
|
|
|
|
|
connect(self, ip, port, addressType); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|