var net = require("net");
var client = net.connect({port:8124},function(){
console.log("client connected");
client.write("world \r\n");
});
client.on("data",function(data){
console.log(data.toString());
client.end();
});
client.on("drain",function(){
console.log("send data clear");
});
client.on("end",function(){
console.log("client disconnected");
});
NodeJS 创建TCP服务器 客户端
最新推荐文章于 2024-06-01 21:28:51 发布