Re: Win32 BIO server, no accept

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Riddle solved:

Must call BIO_new_accept(“0.0.0.0:4444”) and it works.

 

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

 

Hello,

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:

 

 

             SSL_load_error_strings();

             ERR_load_BIO_strings();

             OpenSSL_add_all_algorithms();

 

             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");

                           ERR_print_errors_fp(stderr);

                           exit(1);

             }

 

             /* Wait for incoming connection */

             if (BIO_do_accept(abio) <= 0) {

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

                           ERR_print_errors_fp(stderr);

                           exit(1);

             }

             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,

Karsten

 

-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux