[openssl-users] Win32 BIO server, no accept

Karsten Gorkow karsten.gorkow at insite-gmbh.de
Tue Nov 13 10:42:39 UTC 2018

Riddle solved: 

Must call BIO_new_accept("") and it works.


Von: openssl-users <openssl-users-bounces at openssl.org> Im Auftrag von
Karsten Gorkow
Gesendet: Montag, 12. November 2018 18:26
An: openssl-users at openssl.org
Betreff: [openssl-users] Win32 BIO server, no accept



I'm pretty new to OpenSSL and need to implement a secure connection. It's a
Win32 application that uses a standard socket implementation up to now and
runs for some years already. 

To implement SSL/TLS I downloaded 1.1 and compiled the DLLs for VS2015. The
tests are all "green".

Now I started to integrate OpenSSL into the application. First step for me
is to replace the socket implementation with BIO, no security stuff is
involved yet. 

The app can be configured to act as a TCP server or a client. I was able to
get it to work via BIO as a client, but the problem is the server role. I
don't get a valid (second) accept call, no client is able to connect. Inside
the app this is done via a non-blocking listening socket (return value is
always -1 with "WOULDBLOCK" set), but I even copied the sample code from the
blog (blocking mode) into the app's initialization code and the second call
to BIO_do_accept never returns:







             BIO *abio, *cbio, *cbio2;


             /* First call to BIO_accept() sets up accept BIO */

             abio = BIO_new_accept("4444");

             if (BIO_do_accept(abio) <= 0) {

                           fprintf(stderr, "Error setting up accept\n");





             /* Wait for incoming connection */

             if (BIO_do_accept(abio) <= 0) {

                           fprintf(stderr, "Error accepting connection\n");




             fprintf(stderr, "Connection 1 established\n");


             /* Retrieve BIO for connection */

             cbio = BIO_pop(abio);




What's the problem here? I'm currently running under Win 8.1.


Best regards,



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20181113/5b455b38/attachment-0001.html>

More information about the openssl-users mailing list