Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

mini-IRCd

by tekniko (Deacon)
on Jul 20, 2001 at 18:18 UTC ( [id://98420]=perlquestion: print w/replies, xml ) Need Help??

tekniko has asked for the wisdom of the Perl Monks concerning the following question:

I tried to do it in as few lines as possible and something broke, but I can't tell where. Any suggestions? Thanks!
#!/usr/local/bin/perl #telnet to port 2323 sub p{print@_}$SIG{CHLD}=sub{wait};socket S,2,2,6;bind S,pack(Snx12,2, +2323); listen S,5;while(accept C,S){if(!fork){open(STDOUT,">&C");p"name:";$n= +substr <C>,0,-2;$f=fork||exec"tail -f chatlog";open W,">>chatlog";select(W);$ +|=1;p "[$n here]\r\n";while(<C>){p"$n> $_";}p"[$n gone]\r\n";kill 15,$f;exit +}}

Replies are listed 'Best First'.
Re: mini-IRCd
by c-era (Curate) on Jul 20, 2001 at 18:42 UTC
    Move your accept statment out of the while, and set the while to always be true (you may need to add an if statement).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://98420]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-18 05:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found