var server = http.createServer();
server.on(‘request’, function (request, response) {
console.log("部分页面response:"+1);
socket.on('data',function(data){
response.writeHead(200, { 'Content-Type' : 'text/html; charset=UTF-8' });
response.write(data);
console.log("部分页面:"+data);
});
//socket连接出错,关闭连接
socket.on('error',function(error){
console.log('error:'+error);
socket.destroy();
});
socket.on('close',function(){
//正常关闭连接
console.log('Connection closed');
socket.destroy();
});
response.end();
});