Node.js 指定 tls 连接超时 [英] Node.js specify tls connect timeout

查看:34
本文介绍了Node.js 指定 tls 连接超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为 tls.connect() 调用指定超时时间?我知道服务器有握手超时,客户端有类似的吗?

How can I specify timeout for an tls.connect() call? I know there is handshakeTimeout for server, is there something similar for client?

推荐答案

你应该可以调用 tlssock.setTimeout() 调用底层 socket.setTimeout().socket.setTimeout() 与 TLS 服务器用于 握手超时.

You should be able to call tlssock.setTimeout() which calls the underlying socket.setTimeout(). socket.setTimeout() is the same mechanism that the TLS server uses for the handshakeTimeout.

这篇关于Node.js 指定 tls 连接超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆