| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ad1a823 commit 3348dde
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -294,6 +294,7 @@ TCP server, the argument is as follows, otherwise the argument is `undefined`. | |||
| 294 | 294 | * `data` {Object} The argument passed to event listener. | |
| 295 | 295 | * `localAddress` {string} Local address. | |
| 296 | 296 | * `localPort` {number} Local port. | |
| 297 | + * `localFamily` {string} Local family. | ||
| 297 | 298 | * `remoteAddress` {string} Remote address. | |
| 298 | 299 | * `remotePort` {number} Remote port. | |
| 299 | 300 | * `remoteFamily` {string} Remote IP family. `'IPv4'` or `'IPv6'`. | |
@@ -1045,6 +1046,16 @@ added: v0.9.6 | |||
| 1045 | 1046 | ||
| 1046 | 1047 | The numeric representation of the local port. For example, `80` or `21`. | |
| 1047 | 1048 | ||
| 1049 | + ### `socket.localFamily` | ||
| 1050 | + | ||
| 1051 | + <!-- YAML | ||
| 1052 | + added: REPLACEME | ||
| 1053 | + --> | ||
| 1054 | + | ||
| 1055 | + * {string} | ||
| 1056 | + | ||
| 1057 | + The string representation of the local IP family. `'IPv4'` or `'IPv6'`. | ||
| 1058 | + | ||
| 1048 | 1059 | ### `socket.pause()` | |
| 1049 | 1060 | ||
| 1050 | 1061 | * Returns: {net.Socket} The socket itself. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -840,6 +840,9 @@ protoGetter('localPort', function localPort() { | |||
| 840 | 840 | return this._getsockname().port; | |
| 841 | 841 | }); | |
| 842 | 842 | ||
| 843 | + protoGetter('localFamily', function localFamily() { | ||
| 844 | + return this._getsockname().family; | ||
| 845 | + }); | ||
| 843 | 846 | ||
| 844 | 847 | Socket.prototype[kAfterAsyncWrite] = function() { | |
| 845 | 848 | this[kLastWriteQueueSize] = 0; | |
@@ -1674,6 +1677,7 @@ function onconnection(err, clientHandle) { | |||
| 1674 | 1677 | clientHandle.getsockname(localInfo); | |
| 1675 | 1678 | data.localAddress = localInfo.address; | |
| 1676 | 1679 | data.localPort = localInfo.port; | |
| 1680 | + data.localFamily = localInfo.family; | ||
| 1677 | 1681 | } | |
| 1678 | 1682 | if (clientHandle.getpeername) { | |
| 1679 | 1683 | const remoteInfo = ObjectCreate(null); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,7 @@ const net = require('net'); | |||
| 27 | 27 | const server = net.createServer(common.mustCall(function(socket) { | |
| 28 | 28 | assert.strictEqual(socket.localAddress, common.localhostIPv4); | |
| 29 | 29 | assert.strictEqual(socket.localPort, this.address().port); | |
| 30 | + assert.strictEqual(socket.localFamily, this.address().family); | ||
| 30 | 31 | socket.on('end', function() { | |
| 31 | 32 | server.close(); | |
| 32 | 33 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments