Add socket.address()

This commit is contained in:
Ryan Dahl committed 2009-12-30 00:57:55 -08:00
1 parent 2582560f91
commit 402755b14a
2 files changed
+8 -3

No files matched your search

+7 -2
View File
@@ -335,6 +335,11 @@ Socket.prototype.connect = function () {
};
Socket.prototype.address = function () {
return getsockname(this.fd);
};
Socket.prototype.forceClose = function (exception) {
if (this.fd) {
this.readable = false;
@@ -471,8 +476,8 @@ Server.prototype.listen = function () {
};
Server.prototype.sockName = function () {
return getsockname(self.fd);
Server.prototype.address = function () {
return getsockname(this.fd);
};
+1 -1
View File
@@ -28,7 +28,7 @@ var server = new net.Server(function (socket) {
sys.puts("server-side socket drain");
});
});
server.listen(8000, "localhost");
server.listen(8000);
sys.puts("server fd: " + server.fd);