[gnutls-devel] Waiting for input data

Tim Ruehsen tim.ruehsen at gmx.de
Fri Feb 8 15:25:13 CET 2013


Am Friday 08 February 2013 schrieb Jaak Ristioja:
> On 08.02.2013 15:54, Tim Ruehsen wrote:
> > Maybe this code snippet/example from libmget (License LGPL3+) may help
> > you: It assumes a non-blocking socket descriptor set by
> > 
> > 	gnutls_transport_set_ptr(session, (void *)(ssize_t)sockfd);
> 
> Well I have used (void *)(intptr_t) sockfd, but it doesn't solve the
> real issue here, it just silences the compiler. When converted back
> using (int)(intptr_t), it might not compare equal to the original.

That was not the point of my mail, but it is interesting.

If I got you right, your question was: how can I read from a non-blocking 
socket (using gnutls_record_check_pending()).

My answer just said, how I do it.
It might be of help, but maybe not.


If casting from int to void * and back doesn't work on your machine, I would 
be interested in the output of

#include <stdio.h>
void main(void) {
	int x=1;
	void *p=(void *)(ssize_t)x;
	x=(int)(ssize_t)p;
	printf("%p %d\n",p,x);
	return 0;
}

Regards, Tim



More information about the Gnutls-devel mailing list