@@ -89,13 +89,17 @@ Don't call `server.address()` until the `'listening'` event has been emitted.
89
89
added: v0.1.90
90
90
-->
91
91
92
+ * Returns: {net.Server}
93
+
92
94
Stops the server from accepting new connections and keeps existing
93
95
connections. This function is asynchronous, the server is finally
94
96
closed when all connections are ended and the server emits a [ ` 'close' ` ] [ ] event.
95
97
The optional ` callback ` will be called once the ` 'close' ` event occurs. Unlike
96
98
that event, it will be called with an Error as its only argument if the server
97
99
was not open when it was closed.
98
100
101
+ Returns ` server ` .
102
+
99
103
### server.connections
100
104
<!-- YAML
101
105
added: v0.2.0
@@ -128,6 +132,7 @@ added: v0.5.10
128
132
* ` handle ` {Object}
129
133
* ` backlog ` {number}
130
134
* ` callback ` {Function}
135
+ * Returns: {net.Server}
131
136
132
137
The ` handle ` object can be set to either a server or socket (anything
133
138
with an underlying ` _handle ` member), or a ` {fd: <n>} ` object.
@@ -158,6 +163,7 @@ added: v0.11.14
158
163
* ` path ` {string} - Optional.
159
164
* ` exclusive ` {boolean} - Optional.
160
165
* ` callback ` {Function} - Optional.
166
+ * Returns: {net.Server}
161
167
162
168
The ` port ` , ` host ` , and ` backlog ` properties of ` options ` , as well as the
163
169
optional callback function, behave as they do on a call to
@@ -189,6 +195,7 @@ added: v0.1.90
189
195
* ` path ` {string}
190
196
* ` backlog ` {number}
191
197
* ` callback ` {Function}
198
+ * Returns: {net.Server}
192
199
193
200
Start a local socket server listening for connections on the given ` path ` .
194
201
@@ -227,6 +234,7 @@ subsequent call will *re-open* the server using the provided options.
227
234
<!-- YAML
228
235
added: v0.1.90
229
236
-->
237
+ * Returns: {net.Server}
230
238
231
239
Begin accepting connections on the specified ` port ` and ` hostname ` . If the
232
240
` hostname ` is omitted, the server will accept connections on any IPv6 address
@@ -289,23 +297,23 @@ with [`child_process.fork()`][].
289
297
added: v0.9.1
290
298
-->
291
299
300
+ * Returns: {net.Server}
301
+
292
302
Opposite of ` unref ` , calling ` ref ` on a previously ` unref ` d server will * not*
293
303
let the program exit if it's the only server left (the default behavior). If
294
304
the server is ` ref ` d calling ` ref ` again will have no effect.
295
305
296
- Returns ` server ` .
297
-
298
306
### server.unref()
299
307
<!-- YAML
300
308
added: v0.9.1
301
309
-->
302
310
311
+ * Returns: {net.Server}
312
+
303
313
Calling ` unref ` on a server will allow the program to exit if this is the only
304
314
active server in the event system. If the server is already ` unref ` d calling
305
315
` unref ` again will have no effect.
306
316
307
- Returns ` server ` .
308
-
309
317
## Class: net.Socket
310
318
<!-- YAML
311
319
added: v0.3.4
@@ -501,6 +509,10 @@ specifies:
501
509
502
510
- ` path ` : Path the client should connect to (Required).
503
511
512
+ For either case:
513
+
514
+ * Returns: {net.Socket} The socket itself.
515
+
504
516
Normally this method is not needed, as ` net.createConnection ` opens the
505
517
socket. Use this only if you are implementing a custom Socket.
506
518
@@ -520,6 +532,8 @@ added: v0.1.90
520
532
As [ ` socket.connect(options[, connectListener]) ` ] [ `socket.connect(options, connectListener)` ] ,
521
533
with options as either ` {port: port, host: host} ` or ` {path: path} ` .
522
534
535
+ * Returns: {net.Socket} The socket itself.
536
+
523
537
### socket.connecting
524
538
<!-- YAML
525
539
added: v6.1.0
@@ -550,6 +564,8 @@ connection is destroyed no further data can be transferred using it.
550
564
added: v0.1.90
551
565
-->
552
566
567
+ * Returns: {net.Socket} The socket itself.
568
+
553
569
Half-closes the socket. i.e., it sends a FIN packet. It is possible the
554
570
server will still send some data.
555
571
@@ -575,6 +591,8 @@ The numeric representation of the local port. For example,
575
591
576
592
### socket.pause()
577
593
594
+ * Returns: {net.Socket} The socket itself.
595
+
578
596
Pauses the reading of data. That is, [ ` 'data' ` ] [ ] events will not be emitted.
579
597
Useful to throttle back an upload.
580
598
@@ -583,12 +601,12 @@ Useful to throttle back an upload.
583
601
added: v0.9.1
584
602
-->
585
603
604
+ * Returns: {net.Socket} The socket itself.
605
+
586
606
Opposite of ` unref ` , calling ` ref ` on a previously ` unref ` d socket will * not*
587
607
let the program exit if it's the only socket left (the default behavior). If
588
608
the socket is ` ref ` d calling ` ref ` again will have no effect.
589
609
590
- Returns ` socket ` .
591
-
592
610
### socket.remoteAddress
593
611
<!-- YAML
594
612
added: v0.5.10
@@ -615,13 +633,17 @@ The numeric representation of the remote port. For example,
615
633
616
634
### socket.resume()
617
635
636
+ * Returns: {net.Socket} The socket itself.
637
+
618
638
Resumes reading after a call to [ ` pause() ` ] [ ] .
619
639
620
640
### socket.setEncoding([ encoding] )
621
641
<!-- YAML
622
642
added: v0.1.90
623
643
-->
624
644
645
+ * Returns: {net.Socket} The socket itself.
646
+
625
647
Set the encoding for the socket as a [ Readable Stream] [ ] . See
626
648
[ ` stream.setEncoding() ` ] [ ] for more information.
627
649
@@ -630,6 +652,8 @@ Set the encoding for the socket as a [Readable Stream][]. See
630
652
added: v0.1.92
631
653
-->
632
654
655
+ * Returns: {net.Socket} The socket itself.
656
+
633
657
Enable/disable keep-alive functionality, and optionally set the initial
634
658
delay before the first keepalive probe is sent on an idle socket.
635
659
` enable ` defaults to ` false ` .
@@ -639,25 +663,25 @@ data packet received and the first keepalive probe. Setting 0 for
639
663
initialDelay will leave the value unchanged from the default
640
664
(or previous) setting. Defaults to ` 0 ` .
641
665
642
- Returns ` socket ` .
643
-
644
666
### socket.setNoDelay([ noDelay] )
645
667
<!-- YAML
646
668
added: v0.1.90
647
669
-->
648
670
671
+ * Returns: {net.Socket} The socket itself.
672
+
649
673
Disables the Nagle algorithm. By default TCP connections use the Nagle
650
674
algorithm, they buffer data before sending it off. Setting ` true ` for
651
675
` noDelay ` will immediately fire off data each time ` socket.write() ` is called.
652
676
` noDelay ` defaults to ` true ` .
653
677
654
- Returns ` socket ` .
655
-
656
678
### socket.setTimeout(timeout[ , callback] )
657
679
<!-- YAML
658
680
added: v0.1.90
659
681
-->
660
682
683
+ * Returns: {net.Socket} The socket itself.
684
+
661
685
Sets the socket to timeout after ` timeout ` milliseconds of inactivity on
662
686
the socket. By default ` net.Socket ` do not have a timeout.
663
687
@@ -670,19 +694,17 @@ If `timeout` is 0, then the existing idle timeout is disabled.
670
694
The optional ` callback ` parameter will be added as a one time listener for the
671
695
[ ` 'timeout' ` ] [ ] event.
672
696
673
- Returns ` socket ` .
674
-
675
697
### socket.unref()
676
698
<!-- YAML
677
699
added: v0.9.1
678
700
-->
679
701
702
+ * Returns: {net.Socket} The socket itself.
703
+
680
704
Calling ` unref ` on a socket will allow the program to exit if this is the only
681
705
active socket in the event system. If the socket is already ` unref ` d calling
682
706
` unref ` again will have no effect.
683
707
684
- Returns ` socket ` .
685
-
686
708
### socket.write(data[ , encoding] [ , callback ] )
687
709
<!-- YAML
688
710
added: v0.1.90
@@ -844,6 +866,8 @@ automatically set as a listener for the [`'connection'`][] event.
844
866
}
845
867
```
846
868
869
+ * Returns: {net.Server}
870
+
847
871
If ` allowHalfOpen ` is ` true ` , then the socket won't automatically send a FIN
848
872
packet when the other end of the socket sends a FIN packet. The socket becomes
849
873
non-readable, but still writable. You should call the [ ` end() ` ] [ ] method explicitly.
0 commit comments