From: <ve...@gm...> - 2003-06-24 10:51:11
|
> What does the code in your CGI that uses this Select package look like? > > The problem may be that STDOUT for webmin CGI scripts is not actually > directly connected to the network, but instead is tied to a special perl > package (miniserv) that interprets HTTP headers before actually sending > them back to the web browser. > > - Jamie hm, yes, i think that could be the problem, because for irc a direct a dirct connection is needed. i pase the important code. thanks This is a iframe, which is called from a normal webmin page. #!/usr/bin/perl require './admirc-lib.pl'; &ReadParse(); &header(); [a lot of variables] use IO::Socket::INET; use IO::Select; use Term::ANSIColor; # main prog $| = 1; &c($servercolor); $data .= "*** "; &c('bold red'); $data .= "x.pl v$version"; &c($servercolor); $data .= " connecting to server $server on port $port\n"; $sock = new IO::Socket::INET->new(PeerAddr => $server, PeerPort => $port, Proto => 'tcp'); $sel = new IO::Select->new(); $sel->add($sock); $sel->add($cmd); $sel->add(STDIN); die "*E* Could not Connect to '$server' on port $port.\n" unless $sock; $username = $ENV{'USERNAME'} || $nick; $data .= "$sock \"USER $username 0 * :$realname\n\""; $data .= "$sock \"NICK $nick\n\""; while(@ready){# = $sel->can_read) { &c('reset'); foreach $fh (@ready) { if ($fh == $sock) { sysread($sock,$buf,4096); die("*** connection to server lost, sorry :P\n") unless $buf; @bufs = split(/\n/,$buf); foreach (@bufs) { &c($servercolor); &parse_serverline($_); &c($textcolor); } } if($fh == STDIN) { &c($servercolor); $buf = <STDIN>; &parse_userline($buf); &c($textcolor); } if($fh eq $command) { &c($servercolor); $buf = $command; &parse_commandline($buf); &c($textcolor); } } &c($incolor); } &c('reset'); [build html] [more sub funktions] -- +++ GMX - Mail, Messaging & more http://www.gmx.net +++ Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage! |