Advertisement
Guest User

Untitled

a guest
May 24th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. var net = require('net');
  2.  
  3. var client = new net.Socket();
  4. client.connect(3333, 'localhost', function() {
  5. console.log('Connected');
  6. client.write('Hello, server! Love, Client.');
  7. });
  8. client.on('data', function(data) {
  9. console.log('Received: ' + data.toString());
  10. //client.destroy();
  11. });
  12.  
  13. client.on('close', function() {
  14. console.log('Connection closed');
  15. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement