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?