Created
September 24, 2012 18:42
-
-
Save timglabisch/3777555 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//websocket----------------------------------------------------------------- | |
var io = require("socket.io").listen(72); | |
io.sockets.on('connection', function (socket) { | |
socket.send("Start<br>"); | |
socket.on('disconnect', function () { | |
console.log("Connection terminated"); | |
}); | |
}); | |
//tcp------------------------------------------------------------------------ | |
var net = require("net"); | |
var tcpPort = 1337; | |
var tcpServer = net.createServer(); | |
tcpServer.on('connection', function(client){ | |
console.log("tcp server started..."); | |
client.on('data', function(data){ | |
console.log(data); | |
}); | |
}); | |
tcpServer.listen(tcpPort, function(){ | |
console.log("tcp server listening on: " + tcpPort); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment