On Tue, Jun 10, 2008 at 10:20:56PM -0700, David Schwartz wrote: > > > This code just goes into a loop and keeps writing the first piece > > of info it reads. What am I doing wrong here? > > > > while (nread = BIO_gets(out, buf, sizeof(buf) ) ) > > { > > err = BIO_write(out,buf,nread ); > > } > > That's precisely what it's coded to do. Get a byte, then write that byte > out, then get that byte then write it out. (Perhaps you meant to 'gets' from > a different 'BIO' than you 'write' to?) >
I have been trying BIO_read, BIO_write, BIO_gets, and BIO_puts and I can't seem to get a simple echo server and client to work. BIO_gets is supposed to read a line, correct? Server while ( nread = BIO_gets(out, buf, sizeof(buf) ) ) { err = BIO_write(out,buf,nread ); } Client fgets(buf, sizeof(buf), stdin); { n = strlen(buf); buf[n+1] = '\0'; p = BIO_write(bio,buf, n + 1 ); while ( n = BIO_gets(bio, buf2, sizeof(buf2) ) ) { printf("%s", buf2); } } -- Brian Lavender http://www.brie.com/brian/ ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]