On Jan 14, 4:07 pm, [EMAIL PROTECTED] (Robert Leibl) wrote: > Turner wrote: > > Hello Perl gurus, > > > I'm currently in the process of writing a chat server in Perl. > > Everything is all hunky-dory--it parses commands as it should, and is, > > of course, quite satisfying. Except for one thing, and that is that it > > cannot handle multiple clients at once, which, needless to say, is > > kind of useful for a chat program, isn't it? So I've been following > > the discussion online of Threads vs. forking vs. non-blocking IO, and > > I've decided to try threads, which is neat because this is the first > > thing I've ever done with threading. However, my excitement has been > > somewhat dampened by the fact that it does not work. It can still > > happily handle a single client--no complaints there. However, it can > > still ONLY handle a single client. There's probably a hole in my > > understanding of threads (e.g., I don't entirely understand what > > join() and detach() DO...). Below is the relevant server code, and I > > was hoping some kind soul could look at it, suppress his laughter at > > my naive code and point me in the right direction. > > [...] > > If you just want to handle multiple clients, you may want to look at the > select() function. > (See the bottom part in the perldoc-umentation. The one with RBITS, > WBITS, ... or herehttp://www.perlfect.com/articles/select.shtml)
Thank you, that was exactly what I needed. It works beautifully now. Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/