Browse Source

doc: clearer log messages in net code samples

Code examples in documentation for net.createServer and
net.createConnection contained confusing log messages. This change makes
them clearer.

Signed-off-by: Julien Gilli <julien.gilli@joyent.com>
v0.10.34-release
pkcs 10 years ago
committed by Julien Gilli
parent
commit
8120015f40
  1. 8
      doc/api/net.markdown

8
doc/api/net.markdown

@ -26,9 +26,9 @@ on port 8124:
var net = require('net'); var net = require('net');
var server = net.createServer(function(c) { //'connection' listener var server = net.createServer(function(c) { //'connection' listener
console.log('server connected'); console.log('client connected');
c.on('end', function() { c.on('end', function() {
console.log('server disconnected'); console.log('client disconnected');
}); });
c.write('hello\r\n'); c.write('hello\r\n');
c.pipe(c); c.pipe(c);
@ -86,7 +86,7 @@ Here is an example of a client of echo server as described previously:
var net = require('net'); var net = require('net');
var client = net.connect({port: 8124}, var client = net.connect({port: 8124},
function() { //'connect' listener function() { //'connect' listener
console.log('client connected'); console.log('connected to server!');
client.write('world!\r\n'); client.write('world!\r\n');
}); });
client.on('data', function(data) { client.on('data', function(data) {
@ -94,7 +94,7 @@ Here is an example of a client of echo server as described previously:
client.end(); client.end();
}); });
client.on('end', function() { client.on('end', function() {
console.log('client disconnected'); console.log('disconnected from server');
}); });
To connect on the socket `/tmp/echo.sock` the second line would just be To connect on the socket `/tmp/echo.sock` the second line would just be

Loading…
Cancel
Save