Don't use recv on a TCP socket.

* Use read(n) if you know you need to read exactly n bytes.
* Use read() if you want to read until the other end closes the socket.
* Use gets() if you want to read up to the next end-of-line.

As a last resort, you can use readpartial(n) to get however many bytes 
are available in the receive buffer at the time, between 1 and n. But 
you'll need to repeat this until you're sure you have the complete 
message.

Which to use depends on how the other end frames its response. I'd try 
read(), on the assumption that the other end sends its response and then 
closes the socket.
-- 
Posted via http://www.ruby-forum.com/.