C - BIO_get_fd()始终无法获得有效的FD(C - BIO_get_fd() always fails to get a valid FD)
为什么BIO_get_fd()总是无法在下面的代码中获得有效的FD?
SSL *pSsl = NULL; int nRet; int fdSocket; fd_set connectionfds; struct timeval timeout; BIO_get_ssl(pBio, &pSsl); if (!pSsl) // failed to get SSL pointer of BIO. SSL_set_mode(pSsl, SSL_MODE_AUTO_RETRY); BIO_set_conn_hostname(pBio, "HostName"); BIO_set_conn_port(pBio, "PortNumber"); BIO_set_nbio(pBio, 1); nRet = BIO_do_connect(pBio); if ((nRet <= 0) && !BIO_should_retry(pBio)) // failed to establish connection. if (BIO_get_fd(pBio, &fdSocket) <= 0) // failed to get fd but why? if (nRet <= 0) { FD_ZERO(&connectionfds); FD_SET(fdSocket, &connectionfds); timeout.tv_usec = 0; timeout.tv_sec = 10; nRet = select(fdSocket + 1, NULL, &connectionfds, NULL, &timeout); if (nRet == 0) // timeout has occurred. }
- 通过调用BIO * BIO_new_ssl_connect(SSL_CTX * ctx)预先正确创建我的BIO对象
- 我的OpenSSL版本是v1.0.1e
- 我在Ubuntu for ARM上进行交叉编译
Why does BIO_get_fd() always fail to get a valid FD in the following piece of code?
SSL *pSsl = NULL; int nRet; int fdSocket; fd_set connectionfds; struct timeval timeout; BIO_get_ssl(pBio, &pSsl); if (!pSsl) // failed to get SSL pointer of BIO. SSL_set_mode(pSsl, SSL_MODE_AUTO_RETRY); BIO_set_conn_hostname(pBio, "HostName"); BIO_set_conn_port(pBio, "PortNumber"); BIO_set_nbio(pBio, 1); nRet = BIO_do_connect(pBio); if ((nRet <= 0) && !BIO_should_retry(pBio)) // failed to establish connection. if (BIO_get_fd(pBio, &fdSocket) <= 0) // failed to get fd but why? if (nRet <= 0) { FD_ZERO(&connectionfds); FD_SET(fdSocket, &connectionfds); timeout.tv_usec = 0; timeout.tv_sec = 10; nRet = select(fdSocket + 1, NULL, &connectionfds, NULL, &timeout); if (nRet == 0) // timeout has occurred. }
- My BIO object is properly created beforehand by calling BIO *BIO_new_ssl_connect(SSL_CTX *ctx)
- My OpenSSL version is v1.0.1e
- I'm cross-compiling on Ubuntu for ARM
原文:https://stackoverflow.com/questions/16652246
更新时间:2023-07-18 12:07
最满意答案
改变这个:
(newh > max - 1) ? newh = 0 : void(null); document.location.hash = "#image" + String(newh + 1);
对此:
(newh > max - 1) ? window.location.href = "strategy.html" : document.location.hash = "#image" + String(newh + 1);
change this:
(newh > max - 1) ? newh = 0 : void(null); document.location.hash = "#image" + String(newh + 1);
to this:
(newh > max - 1) ? window.location.href = "strategy.html" : document.location.hash = "#image" + String(newh + 1);
相关问答
更多-
添加float: left到你的li元素。 body.cms-home .main-container #candelabra-carousel.flexslider .slides>li { float: left; } 曹景伟: 修复后: Add float: left to your li elements. body.cms-home .main-container #candelabra-carousel.flexslider .slides>li { float: left; } C ...
-
幻灯片背景标签(Slideshow Background tag)[2021-10-18]
以下是语法错误: setTimout(function() { $('body').css("background-image","url('../img/background/1.jpg')").fadeIn(1000) },5000); 应该 setTimeout(function() { $('body').css("background-image","url('../img/background/1.jpg')").fadeIn(1000)},5000); 它缺少setTimeout中的e 我 ... -
一旦设置了src属性,图像就开始加载,除非(非正式地)元素的css display属性设置为none 。 因此,只要您不设置img元素或JS Image对象的源,就像您发布的代码中的情况一样,图像将不会开始加载。 Images start to load once they have a src attribute set, unless (unofficially) the element's css display property is set to none. So, as long as you ...
-
只需将其添加到CSS #slideshow > div:not(:first-child) { display: none; } 并删除 $("#slideshow > div:gt(0)").hide(); 这是踢得太晚了 $(function() { setInterval(function() { $('#slideshow > div:first') .fadeOut(0) .next() .fadeIn(0) .end ...
-
改变这个: (newh > max - 1) ? newh = 0 : void(null); document.location.hash = "#image" + String(newh + 1); 对此: (newh > max - 1) ? window.location.href = "strategy.html" : document.location.hash = "#image" + String(newh + 1); 的jsfiddle change t ...
-
原因是因为你有两次同样的见证。 如果查看页面的源代码,则表明第一个推荐与第二个完全相同。 幻灯片动画正在发生,但因为它看起来一样,看起来好像什么也没发生。 见这里(第97-110行):
I have worked with HB Projects for circa 10 years although the company has worked for ASDA for significantly longer than that ...
-
使用每个clickhandler按钮重置幻灯片以从第一张幻灯片开始(reset slideshows to start at first slide with each clickhandler button)[2022-07-25]
reset:function(){ if (this.interval) { clearInterval(this.interval); this.interval = false; } this.moveTo($('.slideshow-nav').children().first()); var s ... -
这不是幻灯片,它只是一个图像,每次单击一个按钮(调用JavaScript函数)时,您都会随机更改源。 我的建议是使用JavaScript生成1到5之间的随机数。这样的事情: HTML: JavaScript的: function buttonClicked() { var randomNumber = Math.floor((Math.random()*5)+1); document.getElementById("image").src=" ...
-
幻灯片放映最后一张图像后停止(Slideshow Stops after last image)[2024-01-21]
您在代码中未使用$ active对象。 如果您删除类.slider_active以及另外一个更正,如果您希望所有浏览器都支持,则setInterval仅适用于mozila 用得像 setInterval(slideSwitch, 5000 ); 只是用 $('.slider_active').removeClass('slider_active'); 你的代码是 function slideSwitch() { var $slider_active = $('div.slider IMG ... -
如何确保在页面加载jQuery时加载第一张幻灯片?(How to ensure that the first slide is loaded when the page loads jQuery?)[2023-03-02]
我不是百分之百确定你想要什么,但如果我不得不猜测我会说你可以简单地使用.trigger()来点击任何绑定了点击的元素上的click事件。 $('#nav li a').bind('click', function(){ var numSlide = $(this).attr('rel'); $('.slide-image').html(''); // added the complete ...