服务器端createServer的回调函数被执行时,说明来了一个新的客户端发起的连接:
server = net.createServer(function (socket) { sender = socket.remoteAddress + ":" + socket.remotePort clients.push({ id: sender, socket: socket, group: "", subscription: false, name: "" }); log.info("TCP server has got a new connection: " + sender); record();