[openssl-users] SSL_read preserving message boundaries.

dE de.techno at gmail.com
Sat Mar 7 10:58:40 UTC 2015


It appears that SSL_read does not work like a stream protocol.

This is the server part of the program --

char c[] = "Hello";
SSL_write (sslconnection, &c[0], 1);
SSL_write (sslconnection, &c[1], 1);
SSL_write (sslconnection, &c[2], 1);
SSL_write (sslconnection, &c[3], 1);
SSL_write (sslconnection, &c[4], 1);
SSL_write (sslconnection, &c[5], 1);

And this's the client part --

char c[15];
sleep(2);
SSL_read (sslconnection, c, sizeof(c));
printf ("%s\n", c);

With the TCP implementation, I get a complete 'Hello', with SSL_read, 
I'm only getting 'H', under the next call I get 'e', then the next gives 
'l' etc...

So this is preserving message boundaries. How do I get the complete 
message just like with TCP?


More information about the openssl-users mailing list