From: Robert Klemme Date: 2006-03-29T18:53:42+09:00 Subject: Re: how to build a daemon Dominik Werder wrote: > Hello! > > While building a little network daemon I stumbled upon the following issue: > > I have no idea how much data I can read without blocking. So an attacker > could simply ignore the protocol and stop the transfer so that my daemon > blocks forever.. > How do you avoid this simple issue? The only method I found is setting a > Timeout::timeout 10 do end around the code, but this requires the > timeout module and I don't know if this works reliable.. You'd typically have a thread that handles a connection. So the worst case is that a single thread blocks om IO but this does not block the whole process. You're only out of luck if Ruby is stuck in some long running call into an external C lib (can be a system call or whatever) because it doesn't support native threads (yet). Kind regards robert