Hello

I have a simple question that I can't find an answer to. I'm writing an application where every instance is both client and server (a thread is listening for incoming connections on a predefined port, and at the same time connections are created to others whenever they're needed). Whenever I accept an incoming connection, I'd like to be able to retain the IP address which has just connected (for future use and logging).

I thought I'd be able to achieve this by using the following code (truncated to essentials, left out error handling):

if (BIO_do_accept(accept_bio) > 0)
{
   client = BIO_pop(accept_bio);
   BIO_get_conn_hostname(client); // returns NULL
}

However, I've found that BIO_get_conn_hostname() always returns NULL on incoming connections. This happens for all connections (plain/SSL). The connections, however, work fine and transmit data as they should. I assume this is intended - that the hostname is null, but I don't know how to go about actually retrieving it. I'd like to keep using the BIO abstraction if possible. How would I go on from here?

Thanks in advance,
Laura

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to