Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var net = require("net");
- srv = net.createServer();
- srv.listen(8888);
- srv.on('error', function(e) { console.log("Server got an error: " + e.message);});
- srv.on('connection', function(socket){console.log("connected "+ socket.readable);
- socket.write("It's the right socket");
- socket.on('error', function(e) { console.log("Socket got an error: " + e.message);});
- socket.on("data", function(chunk){
- console.log("SOCKET: " +chunk);
- });
- });
- console.log("Server has started.");
- ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement