SSL_READ and SSL_WRITE with timeouts non-blocking

preetam
Posts: 49
Joined: Thu Jan 26, 2017 2:31 pm
Location: Germany

SSL_READ and SSL_WRITE with timeouts non-blocking

Postby preetam » Tue Mar 07, 2017 9:16 am

Hi,

I would like to issue a timeout on ssl_read and ssl_write after a few seconds.
is there a api for this in non-blocking way.

Thanks
Paul

f.h-f.s.
Posts: 214
Joined: Thu Dec 08, 2016 2:53 pm

Re: SSL_READ and SSL_WRITE with timeouts non-blocking

Postby f.h-f.s. » Thu Mar 09, 2017 3:16 pm

Hi, I use this to set my ssl connection to non-blocking.
SSL_get_fd(1) is from openssl/ssl.h
fcntl(3) is from lwip/sockets.h see lwip_fcntl

Code: Select all

	//non-blocking connection
	int fd = SSL_get_fd(_ssl);
	fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
	SSL_set_fd(_ssl, fd);

preetam
Posts: 49
Joined: Thu Jan 26, 2017 2:31 pm
Location: Germany

Re: SSL_READ and SSL_WRITE with timeouts non-blocking

Postby preetam » Fri Mar 10, 2017 9:27 am

Thank you for the information.
I will try to run some code using this.

Who is online

Users browsing this forum: No registered users and 117 guests