tcp.io
v0.0.8
Published
Simple Net tcp Server and Client
Downloads
5
Readme
tcp.io
Server Example:
var tcp =require("tcp.io");
var server = new tcp.server()
server.on(function(c){
c.on("ping", function(data){
console.log("Server Count Request:%s",data.count);
data.count++;
data.message +=data.count
c.emit("pong",data)
})
});
server.listen(1337,"localhost")
Client Example:
var tcp =require("tcp.io");
var client = new tcp.client()
client.connect(1337,"localhost");
client.emit("ping",{count:0,message:"Hello"}
);
client.on("pong", function(data){
data.count++
console.log("From Server Message :%s",data.message);
data.message="New Hello"
client.emit("ping",data);
})