I have the following Ruby program:
sock = TCPSocket.new(‘host.com’, 12345)
sock.write(‘This is a test’)
data = sock.read(1024)
...The service this connection connects to just reads the string and
write a response which this program then tries to read. I expected it
just work but instead it just hangs. The weird part is that it hangs
the data is actually written out through the socket. The service on the
other end doesn’t get any data. If I remove the end part of the program
that attempts to read the response, the data makes it through and is
correctly by the service.
What is wrong with my program? Why is it hanging?