<div dir="ltr">Hi All,<div><br></div><div>I am trying to establish  DTLS over UDP connection  by using DTLSv1_listen method .</div><div><br></div><div>I have followed the below steps -</div><div>1. Created  a server  socket  and using this socket created bio and ssl object.</div><div>      bio = BIO_new_dgram(VI_sock,BIO_NOCLOSE)) </div><div>      SSL_set_bio(ssl,VP_bio,VP_bio);<br></div><div> <br></div><div>2. Enable cookie exchange on SSL object.</div><div>     SSL_set_options(ssl, SSL_OP_COOKIE_EXCHANGE);</div><div><br></div><div>3. Then started listening using dtlsv1_listen  for the new client connections. Once dtlsv1_listen is successful and i got the peer address.</div><div><br></div><div>4. Once i got the peer address , i am creating one more socket </div><div><br></div><div>5. With the new socket i tried to connect to peer address.</div><div><br></div><div>6. Then i am trying to do ssl_accept on the new socket by calling bio_set_fd.</div><div><br></div><div><div> BIO_set_fd(SSL_get_rbio(ssl),VI_new_sock_id,BIO_NOCLOSE);</div><div> BIO_ctrl(SSL_get_rbio(VP_ssl),BIO_CTRL_DGRAM_SET_CONNECTED, 0, &client_addr);    </div><div> SSL_set_fd(ssl,VI_newsock_id);</div></div><div><br></div><div>  VI_res = SSL_accept(ssl);<br></div><div><br></div><div>But ssl_accept will always return error code 2 [ i.e want read or want write] </div><div><br></div><div>But if i am doing ssl_accept without doing the step no 6 it it will be successful.</div><div><br></div><div>Could someone please let us know how to switch to newly created socket, so that it can start using newly created socket for further read and write operations and original server socket  will keep on listening for new connections.</div><div>   </div><div><br></div><div>Regards,</div><div>Nivedita</div><div><br></div></div>