[Techtalk] Perl Sockets Communication

Sean McAfee mcafee at transmeta.com
Wed Aug 22 15:14:06 EST 2001


Kai MacTane <kmactane at GothPunk.com> wrote:
>LOOP:
>             for ( ; my $paddr = accept(Client, Sock); close Client)
>             {
>                 print CLIENT "Printing to client filehandle.\n";
>
>                 my $line = <CLIENT>;
>                 chomp $line;
>
>                 &write_syslog('Client connection; content: "%s"', $line);
<snip>

I haven't done a thorough test of your program, but here you're accepting a
new connection on the handle 'Client', but referring to it in the body of
the loop as 'CLIENT'.  Perl is case-sensitive, so these are different
handles.  Change the for loop test to:

my $paddr = accept(CLIENT, Sock);

...and that problem, at least, should be solved.


--Sean




More information about the Techtalk mailing list