Scarborough has asked for the wisdom of the Perl Monks concerning the following question:
Thanks to the monks for the answer to Streaming to a socket it worked brilliently when my client was working at the command promt.
while (defined($buf = <$sock>){ print $buf; }
However I have tried to display this in a Tk gui but the text does not display until all the data has been returned. This is what I have tried
use IO::Socket; use Tk; my $mw = new MainWindow(); my $b = $mw->Button(-text=>'GO', -command=>\&conn)->pack(); my $t = $mw->Text()->pack(); #$|++; #tie *OUT, 'Tk::Text', $t; $t->focus(); MainLoop; sub conn{ tie *STDOUT, 'Tk::Text',$t; $|++; $sock = new IO::Socket::INET(PeerAddr => 'myhost', PeerPort => '800', Proto => 'tcp'); die unless $sock; while (defined($buff = <$sock>)){ print $buff; } }
Is it possible to get a live stream to the widget?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Streaming into tk text widgets
by si_lence (Deacon) on Oct 14, 2004 at 13:57 UTC | |
|
Re: Streaming into tk text widgets
by zentara (Cardinal) on Oct 15, 2004 at 12:59 UTC | |
by Scarborough (Hermit) on Oct 18, 2004 at 15:14 UTC |