Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
doc: clearer log messages in net code samples
Browse files Browse the repository at this point in the history
Code examples in documentation for net.createServer and
net.createConnection contained confusing log messages. This change makes
them clearer.

Signed-off-by: Julien Gilli <[email protected]>
  • Loading branch information
pkcs authored and Julien Gilli committed Dec 8, 2014
1 parent f5cb330 commit 8120015
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/api/net.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ on port 8124:

var net = require('net');
var server = net.createServer(function(c) { //'connection' listener
console.log('server connected');
console.log('client connected');
c.on('end', function() {
console.log('server disconnected');
console.log('client disconnected');
});
c.write('hello\r\n');
c.pipe(c);
Expand Down Expand Up @@ -86,15 +86,15 @@ Here is an example of a client of echo server as described previously:
var net = require('net');
var client = net.connect({port: 8124},
function() { //'connect' listener
console.log('client connected');
console.log('connected to server!');
client.write('world!\r\n');
});
client.on('data', function(data) {
console.log(data.toString());
client.end();
});
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
Expand Down

0 comments on commit 8120015

Please sign in to comment.