【发布时间】:2022-02-06 18:14:14
【问题描述】:
with 代码的疑问有两点:
-
当我通过浏览器发送请求时,我没有收到“已连接”的控制台日志消息,但如果我使用 http.get() 或 http.request() ,它工作正常 2) "connect" 事件接收到一个带有 req,clientSocke,head 的回调!现在我在哪里可以看到服务器套接字?
const http=require("http") const server=http.createServer() server.on("connect",(req,c_socket,head)=>{ console.log("connected") }) server.listen(5000,()=>{console.log("server up)})
【问题讨论】: