简体   繁体   English

SSL_do_handshake()被卡住

[英]SSL_do_handshake() get stuck

in my code i call SSL_do_handshake() function. 在我的代码中,我调用SSL_do_handshake()函数。 Everything works fine if the server gets the "right" messages. 如果服务器收到“正确的”消息,一切正常。 BUT, for security issues I tried sending a dummy message. 但是,出于安全性问题,我尝试发送虚拟消息。 just "hello" to the right port and the right ip address. 只是“ hello”到正确的端口和正确的ip地址。 in this case, SSL_do_handshake() gets stuck forever. 在这种情况下,SSL_do_handshake()会永远卡住。 I want the function to return in that case, so that my server will not get stuck. 在这种情况下,我希望函数返回,这样我的服务器就不会卡住。

What are the options ? 有什么选择 ?

I read about setting bio to non-blocking.. I added to my code : BIO_set_nbio(bio, 1); 我阅读了有关将bio设置为非阻塞的信息。我在代码中添加了:BIO_set_nbio(bio,1); before the connection is established.. but it didn't do thew work... 在建立连接之前..但是它没有做...

What can I do ? 我能做什么 ?

BIO_set_nbio sets only the flag, that the bio should be considered non-blocking. BIO_set_nbio仅设置标志,即应将bio视为非阻塞标志。 You have to actually make the socket itself non-blocking. 您实际上必须使套接字本身无阻塞。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM