I'm trying to implement a DTLS server following https://gist.github.com/Jxck/b211a12423622fe304d2370b1f1d30d5, but i'm running into trouble at DTLSv1_listen
. I'm using OpenSSL 1.1.1c, and the peer
arg from DTLSv1_listen
appears to have type of BIO_ADDR *
. I'm confused as to how to use it, as the documentation isn't really helpful. The tutorial just passes in a sockaddr *
(or was it sockaddr_in6
?) to peer. Would that work? If not, how can I convert a BIO_ADDR *
to a sockaddr *
?
Create a new BIO_ADDR object using BIO_ADDR_new
. So something like this:
BIO_ADDR *addr = BIO_ADDR_new();
int ret;
if (addr == NULL)
goto err;
ret = DTLSv1_listen(ssl, addr);
/* Handle the result of DTLSv1_listen */
BIO_ADDR_free(addr);
You can examine the contents of the BIO_ADDR using the various getter functions available. See the BIO_ADDR documentation here: