If data size is zero, discard the msg.
Test recv return while closing.

Some servers (notably talk.google.com) do not close properly streams.