On Sat, Aug 09, 2008 at 12:39:52PM +0300, Nikos Mavrogiannopoulos wrote: > 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.
Ok, thanks. I thought maybe I was overlooking something. I ended up creating a buffer, reading into it, and then looking for a newline in it. brian -- Brian Lavender http://www.brie.com/brian/ _______________________________________________ Help-gnutls mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gnutls
