gpt4 book ai didi

javascript - "Error: write EPIPE"与 node.js 上的 Socket.io

转载 作者:行者123 更新时间:2023-11-30 13:25:12 27 4
gpt4 key购买 nike

我手动应用了这个补丁,现在一切正常。等待上游解决这个问题 https://github.com/LearnBoost/socket.io-client/pull/361/files


我只是尝试遵循给出的示例并尝试使其正常工作。

模拟服务器.js:

var io = require('socket.io').listen(8000);

io.sockets.on('connection', function(client) {
console.log('+ new client');
client.on('disconnect', function() {
console.log('- lost a client');
});
});

模拟客户端.js:

var io = require('socket.io-client');
var socket = new io.connect('localhost', { port: 8000 });

socket.on('connect', function() {
console.log('connected');
});

socket.on('message', function(data) {
console.log(data);
});

然后我在另一个终端上运行这些与 Node Mockserver.js 和 Node Mockclient.js 的对

   info  - socket.io started
debug - client authorized
info - handshake authorized 14797776461130411158
debug - setting request GET /socket.io/1/websocket/14797776461130411158
debug - set heartbeat interval for client 14797776461130411158
debug - client authorized for
debug - websocket writing 1::
+ new client
debug - set close timeout for client 14797776461130411158
***************************** error occurs here ****************
info - socket error Error: write EPIPE
at errnoException (net.js:632:11)
at Object.afterWrite [as oncomplete] (net.js:470:18)
****************************************************************
debug - setting request GET /socket.io/1/xhr-polling/14797776461130411158?t=1325912082073
debug - setting poll timeout
debug - discarding transport
debug - cleared close timeout for client 14797776461130411158
debug - cleared heartbeat interval for client 14797776461130411158
debug - clearing poll timeout
info - transport end
debug- set close timeout for client 14797776461130411158
debug - cleared close timeout for client 14797776461130411158

此时我停止了 Mockclient.js

- lost a client
debug - discarding transport

“node Mockclient.js”的唯一输出是

The "sys" module is now called "util". It should have a similar interface.

是什么导致套接字异常?我可能遗漏了一些非常明显的东西。另外,其他人可以尝试我的代码来查看他们的机器上是否也有错误吗? socket.on('connect'... 中的代码也没有触发。我不完全知道为什么。

最佳答案

关于javascript - "Error: write EPIPE"与 node.js 上的 Socket.io,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8767517/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com