sorry this actually worked and I dont know how to delete
I was going to say that your iss(oss.str()) line was not going to work as you are adding the length data in binary, which will contain (terminating) zeros.
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman