Add socket.address()
This commit is contained in:
parent
2582560f91
commit
402755b14a
@ -335,6 +335,11 @@ Socket.prototype.connect = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Socket.prototype.address = function () {
|
||||||
|
return getsockname(this.fd);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
Socket.prototype.forceClose = function (exception) {
|
Socket.prototype.forceClose = function (exception) {
|
||||||
if (this.fd) {
|
if (this.fd) {
|
||||||
this.readable = false;
|
this.readable = false;
|
||||||
@ -471,8 +476,8 @@ Server.prototype.listen = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Server.prototype.sockName = function () {
|
Server.prototype.address = function () {
|
||||||
return getsockname(self.fd);
|
return getsockname(this.fd);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ var server = new net.Server(function (socket) {
|
|||||||
sys.puts("server-side socket drain");
|
sys.puts("server-side socket drain");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
server.listen(8000, "localhost");
|
server.listen(8000);
|
||||||
sys.puts("server fd: " + server.fd);
|
sys.puts("server fd: " + server.fd);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user