J
Just Another Victim of the Ambient Morality
I have the following Ruby program:
sock = TCPSocket.new('host.com', 12345)
sock.write('This is a test')
data = sock.read(1024)
puts data
...The service this connection connects to just reads the string and
write a response which this program then tries to read. I expected it to
just work but instead it just hangs. The weird part is that it hangs before
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 read
correctly by the service.
What is wrong with my program? Why is it hanging?
Thank you...
sock = TCPSocket.new('host.com', 12345)
sock.write('This is a test')
data = sock.read(1024)
puts data
...The service this connection connects to just reads the string and
write a response which this program then tries to read. I expected it to
just work but instead it just hangs. The weird part is that it hangs before
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 read
correctly by the service.
What is wrong with my program? Why is it hanging?
Thank you...