I'm writing my first extension, which has some low-level networking 
functions to interface with some legacy code.  I have two functions in 
the extension, send, and recv_line, which work with a socket.  I'm 
testing with ruby 1.8.4 on debian using the echo service (port 7).

As a debugging measure, I had the following code, which works perfectly:
puts socket.send("hello\n")
puts socket.recv_line()

If I take the return from the send and place it in a variable, the code 
takes exactly three seconds to run, as opposed to nearly instantly:
foo = socket.send("hello\n")
puts socket.recv_line()

This causes it to hang forever:
socket.send("hello\n")
puts socket.recv_line()

Using strace shows that recv_line is getting the hello, but never 
receives the newline character.  I'm completely baffled.  I can post the 
C code, but it doesn't seem like it would necessarily be the source of 
the problem.  Any input would be greatly appreciated.  Thanks.

-- 
Posted via http://www.ruby-forum.com/.