[gnutls-devel] Waiting for input data

Tim Ruehsen tim.ruehsen at gmx.de
Fri Feb 8 15:38:37 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.

Couldn't you use a pointer to your 'socket'.

	gnutls_transport_set_ptr(session, &sockfd);

and reading back with
	int sockfd = *(int *)gnutls_transport_get_ptr(session);

If your sockfd is of type 'int'. If not, use a different type.

Regards,

     Tim Rühsen



More information about the Gnutls-devel mailing list