Problem with an iterator using yield

Hi together,

I’ve got a problem implementing an iterator. I’m writing a server
application. In the server class I implemented a ‘run’ method, which is
a loop waiting for a connection. Every incoming connection should be
given to main program:

def run
loop do
@sock.accept do
>conn>
yield conn
end
end
end

The main program does something like:

app.run do
>conn>
print "got conn!\n"
end

Ok, fine as far. But when a connection arrives nothing happens. Is there
anything wrong?

Greetings,
CK

      @sock.accept do

#accept don't take a block as arguments.

You have an example for TCPServer in

http://www.ruby-lang.org/en/man-1.4/socket.html#TCPServer
  
Guy Decoux

Hello ts,

···

On Wed, Aug 07, 2002 at 08:34:31PM +0900, ts wrote:

  @sock.accept do

#accept don’t take a block as arguments.

You have an example for TCPServer in

http://www.ruby-lang.org/en/man-1.4/socket.html#TCPServer

Uhm. I’m sorry :confused:

Greetings,
CK