First of all it should be connection
event.
The function passed to createServer becomes the event handler for the 'connection' event.
var server = net.createServer(function (stream) {
//if you are here you are already connected
});
If you want to listen for connection
event do it like this -
var server = net.createServer(function (stream) {
//your code
});
server.addListener("connection", function () {
console.log("connected");
});