This program works, except it does not echo its input from the socket immediately. Can someone modify the client for me so it will display what it reads from the socket immediately? Presently, I only get to see what it reads from the socket if it sees "exit".
Thanks Siegfried #!c:/perl/bin/perl #!/usr/bin/perl #!/usr/local/bin/perl5.8.9 # # $Log$ # # Begin commands to execute this file using Perl with bash # ./client.pl <<EOF # hello # there # EOF # echo "all done" # End commands to execute this file using Perl with bash # use strict; use warnings; use POSIX; use IO::Socket; use threads ('yield', 'stack_size' => 64*4096, 'exit' => 'threads_only', 'stringify'); my $port = 8795; my $rhost = 'localhost'; my $sock = new IO::Socket::INET(PeerAddr => $rhost, PeerPort => $port, Proto => 'tcp', Timeout => 5); sub start_thread { my @args = @_; print('Thread started: ', join(' ', @args), "\n"); my $line; while (<$sock>) { chomp; print "$_\n"; last if /exit/; } } print "Hello ".(strftime "%a %b %d %H:%M:%S %Y\n", localtime); my $thr = threads->create('start_thread', 'argument'); while(<STDIN>){ print $sock $_; } $thr->join(); close $sock; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/