help-gnutls
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gnutls] Equivalent to fdopen?


From: Nikos Mavrogiannopoulos
Subject: Re: [Help-gnutls] Equivalent to fdopen?
Date: Sat, 09 Aug 2008 12:39:52 +0300
User-agent: Thunderbird 2.0.0.16 (X11/20080724)

Brian Lavender wrote:
> I am trying to take a simple socket program and convert it to use
> gnutls. Is there an equivalent to fdopen so I can stream my secured
> socket as an fstream?
> 
> int sock_fd;
> FILE *sock_fpi;
> 
> sock_fd = accept( sock_id, (struct sockaddr *) &sa_cli, &client_len );
> 
> sock_fpi = fdopen( sock_fd, "r" ))
> 
> But when I attempt to convert it to use gnutls, I run into the
> following.
> 
> sock_fd = accept( sock_id, (struct sockaddr *) &sa_cli, &client_len );
> 
> session = initialize_tls_session ();
> 
> gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sock_fd );
> 
> ret = gnutls_handshake (session);
> 
> And, it appears that I can only read using the following command.
> 
> ret = gnutls_record_recv (session, buffer, MAX_BUF);

Isn't this the expected behavior? gnutls does not know about FILE*
pointers, only about descriptors. You'd need a wrapper over
gnutls_record_recv for that.

regards,
Nikos




reply via email to

[Prev in Thread] Current Thread [Next in Thread]