I am looking for a way to convert this segment of code. It's probably not
right but here is the question. How would I retrieve the socket pointer from
OpenSSL. Does OpenSSL even provide this? Also what does OpenSSL provide as a
return from function SSL_get_fd when using Windows?

 

void setBlocking(SSL * sslTemp)

{

            int fd, flags;      

 

            /* SSL_get_rfd returns -1 on error */

            if( (fd = SSL_get_rfd(sslTemp)) )

#ifndef WIN32

            {

                        flags = fcntl(fd, F_GETFL);

                        flags &= ~O_NONBLOCK;

                        fcntl(fd, F_SETFL, flags);

            }

#else

                        ioctlsocket( fd, FIOBIO, 0 );

#endif

            /* SSL_get_wfd returns -1 on error */  

            if( (fd = SSL_get_wfd(sslTemp)) )      

#ifndef WIN32

            {

                        flags = fcntl(fd, F_GETFL);

                        flags &= ~O_NONBLOCK;

                        fcntl(fd, F_SETFL, flags);

            }

#else

                        ioctlsocket( fd, FIOBIO, 0 );

#endif

}

Reply via email to