GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: return this from net.Socket.end() · nodejs/node@063c4fa

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • net.md
  • lib
    • net.js
  • test/parallel
    • test-socket-write-after-fin.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/net.md‎

Copy file name to clipboardExpand all lines: doc/api/net.md
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,8 @@ server will still send some data.
575575
If `data` is specified, it is equivalent to calling
576576
`socket.write(data, encoding)` followed by `socket.end()`.
577577

578+
Returns `socket`.
579+
578580
### socket.localAddress
579581
<!-- YAML
580582
added: v0.9.6
Collapse file

‎lib/net.js‎

Copy file name to clipboardExpand all lines: lib/net.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ Socket.prototype.end = function(data, encoding) {
444444
this.read(0);
445445
else
446446
maybeDestroy(this);
447+
448+
return this;
447449
};
448450

449451

Collapse file

‎test/parallel/test-socket-write-after-fin.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-socket-write-after-fin.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const common = require('../common');
33
const assert = require('assert');
44
const net = require('net');
5-
const expected = 'hello1hello2hello3\nTHUNDERMUSCLE!';
5+
const expected = 'hello1hello2hello3\nbye';
66

77
const server = net.createServer({
88
allowHalfOpen: true
@@ -35,5 +35,6 @@ server.listen(0, common.mustCall(function() {
3535
sock.write('hello1');
3636
sock.write('hello2');
3737
sock.write('hello3\n');
38-
sock.end('THUNDERMUSCLE!');
38+
assert.strictEqual(sock.end('bye'), sock);
39+
3940
}));

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.