var net = require('net'); var tcpServer = net.createServer() var PORT = 6800; tcpServer.on('listening', ()=>{ console.log('开始监听'); }); tcpServer.on('close', ()=>{ console.log('closed'); }); tcpServer.listen(PORT); module.exports = tcpServer;