About sockets recv() method

Hi, i'm programming a mud client in ruby and in order to recive all
the input i did this.

Gtk.idle_add { data = angalon.recv( 8 )
                     data = angalon.preprocess( data )
                     buffer.insert( buffer.end_iter , data )
                   }

but after the first lines are read and printed to the screen the
program becames unresponsive.

i've tested adding
last_time = 0
Gtk.idle_add { puts "Idle" + last_time + "\n"
                     last_time = last_time + 1}

and the program doesn't became unresponsive after it. (ie it responds
to me clicking the exit buttong and sending messages to the buffer.)

so i'm thinking recv() is waiting for something? i thought it was
different than wait for but since the method is implemented in C i
don't know where to read the implementation, can someone tell me how
exactly recv() works or refer me to the C file the is implemented?
(although i would prefer the first option).

Thanks in advance

···

--
                     Rorschach el Pirata

In article <1f963e060508231401429a9819@mail.gmail.com>,
  "OxO pHz.60" <pirata@gmail.com> writes:

so i'm thinking recv() is waiting for something? i thought it was
different than wait for but since the method is implemented in C i
don't know where to read the implementation, can someone tell me how
exactly recv() works or refer me to the C file the is implemented?
(although i would prefer the first option).

recv() waits some data from the socket.
It is suitable behavior for threaded program.

I think it should register the socket to Gtk's main loop to call the
handler when some input is available.

It seems that Glib has such functions.
http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html

···

--
Tanaka Akira