@@ -91,7 +91,7 @@ Use `process.mixin()` to include modules into the global namespace.
91
91
puts('The area of a circle of radius 4 is ' + area(4));
92
92
93
93
94
- ## String Encodings and Buffers
94
+ ## Buffers
95
95
96
96
Pure Javascript is Unicode friendly but not nice to pure binary data. When
97
97
dealing with TCP streams or the file system, it's necessary to handle octet
@@ -381,7 +381,7 @@ your program's flow. Especially for server programs that are designed to
381
381
stay running forever, ` uncaughtException ` can be a useful safety mechanism.
382
382
383
383
384
- ### Signal Events: 'SIGINT'
384
+ ### Signal Events
385
385
386
386
` function () {} `
387
387
@@ -849,7 +849,7 @@ Example:
849
849
grep = spawn('grep', ['ssh']);
850
850
851
851
sys.puts('Spawned child pid: ' + grep.pid);
852
- grep.stdin.close ();
852
+ grep.stdin.end ();
853
853
854
854
855
855
### child.stdin.write(data, encoding)
@@ -877,7 +877,7 @@ Example: A very elaborate way to run 'ps ax | grep ssh'
877
877
if (code !== 0) {
878
878
sys.puts('ps process exited with code ' + code);
879
879
}
880
- grep.stdin.close ();
880
+ grep.stdin.end ();
881
881
});
882
882
883
883
grep.stdout.addListener('data', function (data) {
@@ -895,7 +895,7 @@ Example: A very elaborate way to run 'ps ax | grep ssh'
895
895
});
896
896
897
897
898
- ### child.stdin.close ()
898
+ ### child.stdin.end ()
899
899
900
900
Closes the child process's ` stdin ` stream. This often causes the child process to terminate.
901
901
@@ -909,7 +909,7 @@ Example:
909
909
sys.puts('child process exited with code ' + code);
910
910
});
911
911
912
- grep.stdin.close ();
912
+ grep.stdin.end ();
913
913
914
914
915
915
### child_process.exec(command, callback)
@@ -1359,6 +1359,8 @@ Begin accepting connections on the specified port and hostname. If the
1359
1359
hostname is omitted, the server will accept connections directed to any
1360
1360
address.
1361
1361
1362
+ To listen to a unix socket, supply a filename instead of port and hostname.
1363
+
1362
1364
This function is asynchronous. ` listening ` will be emitted when the server
1363
1365
is ready to accept connections.
1364
1366
@@ -1698,7 +1700,7 @@ A reference to the `http.Client` that this response belongs to.
1698
1700
1699
1701
## net.Server
1700
1702
1701
- This class can be used to create a TCP or UNIX server.
1703
+ This class is used to create a TCP or UNIX server.
1702
1704
1703
1705
Here is an example of a echo server which listens for connections
1704
1706
on port 7000:
@@ -1719,6 +1721,11 @@ on port 7000:
1719
1721
});
1720
1722
server.listen(7000, 'localhost');
1721
1723
1724
+ To listen on the socket ` '/tmp/echo.sock' ` , the last line would just be
1725
+ changed to
1726
+
1727
+ server.listen('/tmp/echo.sock');
1728
+
1722
1729
This is an EventEmitter with the following events:
1723
1730
1724
1731
### Event: 'listening'
@@ -1737,11 +1744,10 @@ Emitted when a new connection is made. `stream` is an instance of
1737
1744
1738
1745
### Event: 'close'
1739
1746
1740
- ` function (errno) {} `
1747
+ ` function () {} `
1748
+
1749
+ Emitted when the server closes.
1741
1750
1742
- Emitted when the server closes. ` errorno ` is an integer which indicates
1743
- what, if any, error caused the server to close. If no error occurred
1744
- ` errorno ` will be 0.
1745
1751
1746
1752
### net.createServer(connectionListener)
1747
1753
@@ -2244,7 +2250,7 @@ The library is called `/repl.js` and it can be used like this:
2244
2250
net.createServer(function (c) {
2245
2251
sys.error('Connection!');
2246
2252
nconnections += 1;
2247
- c.close ();
2253
+ c.end ();
2248
2254
}).listen(5000);
2249
2255
repl.start('simple tcp server> ');
2250
2256
0 commit comments