On 3/17/2011 5:00 AM, ikuzar wrote:

The problem :

when I print data, I have got :
HELLO��y0�y
0�y��y
i`�0�y
������L���L��-M
etc...
instead of
HELLO.

in MYrecv, when I make L = 5, it works

what should I do to read just the right size so that when I print I get
HELLO, GOODBYE, etc ... and not HELLO��y0�y,  GOODBYE��y0�y etc ...
thanks for your help

You made two common rookie mistakes:

1) Your MY_recv function is totally broken. It ignores the return value of SSL_read, so you have no idea how many bytes you received. So even though you received five bytes, you are printing god only knows how many bytes.

2) You forgot to implement a protocol. Who or what said that those five bytes you received should be printed? You need to specify and implement an application protocol on top of SSL. Otherwise, you will continue to make mistakes like '1' above. With a protocol, you'd know how to determine when you had a complete application-level message. Without one, it is impossible to do it right because there is no such thing as 'right'.

DS

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to