gpt4 book ai didi

node.js - node.js 中是否有针对 net.socket 连接的 'writeable' 测试?

转载 作者:太空宇宙 更新时间:2023-11-03 22:47:34 25 4
gpt4 key购买 nike

node.js 中是否有针对 net.socket 连接的“可写”或连接测试?或者我必须做这样的事情:

var client = new net.Socket();
var isConnected = false;
client.connect(5555, 192.168.0.150, function() { isConnected = true; });
client.on('close', function() { isConnected = false; });

最佳答案

您应该能够检查client.writable

关于node.js - node.js 中是否有针对 net.socket 连接的 'writeable' 测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23094358/

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