> I have tried it by splitting the transaction into 2 parts as > client -> server ( actual data size in next call ) > server -> client ( OK ) > client -> server ( actual data ) > server -> client ( received ). This works but because of extra overhead > I want to eliminate it. and make it as > > client -> server ( data length embedded in data ) > server reads the data in ssl_read loop. > server -> client ( received )
Server has packed foo, which consists of 32 bytes header and a dynamic part of 16 SSL_write(ssl, foo, 48); Client does while (1) { struct header_t header; char dynamic[MAX_SIZE]; int size; SSL_read(ssl, &header, 32); size=header.size; /* whatever thingy, and size is set to 16, since server told us so */ SSL_read(ssl, dynamic, size); } You need to add in the non-blocking thingy hear if your sockets are non-blocking. Optionally make your own _SSL_read() function or macro that calls SSL_read and interprates errors at your own wish. SSL_read and SSL_write don't have to match in size for the client and the server side. They just needs to be recalled on each side with the same buffer spec if they didn't finish their buisness for that run. Stian ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager [EMAIL PROTECTED]