[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

TCPServer locking when calling accept

Alex MacCaw

4/3/2007 8:38:00 PM

How do I stop the TCPServer 'locking up' when I call accept?
I'm trying to build a passive ftp server.

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

2 Answers

Brian Candler

4/3/2007 9:24:00 PM

0

On Wed, Apr 04, 2007 at 05:37:40AM +0900, Alex MacCaw wrote:
> How do I stop the TCPServer 'locking up' when I call accept?
> I'm trying to build a passive ftp server.

Start a new thread for each incoming connection.

There's example code (a dummy POP3 server) at
http://www.rubygarden.org/ruby?Singlet...

... except RubyGarden seems to be down again, so try entering this URL in
the waybackmachine at www.archive.org

Regards,

Brian.

Louis R. Marascio

4/4/2007 1:58:00 AM

0

Alex MacCaw <maccman@gmail.com> wrote:
>How do I stop the TCPServer 'locking up' when I call accept?
>I'm trying to build a passive ftp server.

When you say 'locking up' do you mean it won't return from the method
call until a client has connected? If so, this is typically referred to
as 'blocking'. There is a method on TCPServer called 'accept_nonblock'
that may give you the behavior you are looking for.

Best regards,

Louis

--
Louis R. Marascio
louis@fitnr.com