On Fri, Oct 19, 2001 at 12:54:07PM -0400, zentara wrote:
> ###########RECEIVE:################
> #!/usr/bin/perl -w
> use IO::Socket;
> my $sock = new IO::Socket::INET (
>       LocalHost => 'localhost',
>       LocalPort => '7070',
>       Proto => 'tcp',
>       Listen => 1,
>       Reuse => 1,
>                  );
> die "could not create socket: $!\n" unless $sock;
> my $new_sock = $sock->accept();
> while(defined(<$new_sock>)) {

This is your problem.  while (<$new_sock>) assigns the data read from
$new_sock to $_, but defined(<$new_sock>) does not.  Change it to simply
while (<$new_sock>) and everything should work fine.  There is an implied
defined test in that loop, so you don't need to test it yourself.


>     print $_;
>  }

Actually, given the loop you have, it might be simpler and more readable to
use:

    print while <$new_sock>;


>  close($sock);


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to