Node.js套接字挂起错误

与node.js一起使用http.createServer时,出现以下错误:

events.js:48 throw arguments[1]; // Unhandled 'error' event ^ Error: socket hang up at createHangUpError (http.js:1092:15) at Socket.onend (http.js:1155:27) at TCP.onread (net.js:349:26) 

简单的代码:

 http.createServer( connect_cache({rules: [{regex: /.*/, ttl: 60000}]}), function(b_request, b_response){ ..... } ); 

那么,错误是什么意思? 我该如何解决?

谢谢 !

http.createServer()最多只需要一个函数作为参数,然后将其设置为request事件的处理程序。 connect_cache()没有正确的签名是一个处理程序。 据推测,它是作为中间件编写的,可以在Connect或其他内容(如Express)上使用,但不能将Connect中间件直接传递给http.Server的实例; 您需要创build一个Connect对象,将中间件传递给它,然后将Connect对象传递给http.createServer()