In my humble opinion an easy solution to get the body would be to include the Connection: Close header in the sockopen event
Code:
sockwrite -nt $sockname Connection: Close

And use, as said by Wims, the sockread -f in the sockclose event..