SHARE
TWEET

Untitled

a guest Mar 8th, 2013 49 Never
  1. var net = require("net");
  2. srv = net.createServer();
  3. srv.listen(8888);
  4.  
  5. srv.on('error', function(e) { console.log("Server got an error: " + e.message);});
  6. srv.on('connection', function(socket){console.log("connected "+ socket.readable);
  7.         socket.write("It's the right socket");
  8. socket.on('error', function(e) { console.log("Socket got an error: " + e.message);});
  9.  
  10.         socket.on("data", function(chunk){
  11.                 console.log("SOCKET: " +chunk);
  12.  
  13.         });
  14.  
  15.  
  16. });
  17.  
  18. console.log("Server has started.");
  19. ~
RAW Paste Data
Top