[openssl-users] ssl_pending returns 0 despite having data to read

Salz, Rich rsalz at akamai.com
Wed Jan 11 20:25:29 UTC 2017

> During first ssl_read we received eight bytes, and after that ssl_pending
> returns 0. If we continue reading despite having no pending data, ssl_read
> returns the rest of the data.
> Could you please suggest what is wrong here.

Pending is an indication that there is unread data *on the local host.*  It has no idea of what the network is doing, buffering or delaying, and so on.

You'll have to look at adding bytecounts or other "framing" techniques to your protocol to know when enough data has been read.

More information about the openssl-users mailing list