I do some simple modification on your codes,it's surely
not the best solution the more it's not debugged,but I think
maybe it can give you some suggestions.One thing,if you do
want it robust,you need reuse the buffer with a for loop if
the data is large than 10*1024,right?
The more,if things continue,you can add a printf to print
SSL_read 's return code or error message.
If it won't work yet,feel free to mail me,I am not sure I
can help you out,but I think we can discuss with each other
to solve it.
Good luck!
i.c