You're a champ Scott, works great now :)

[EMAIL PROTECTED]:~$ telnet localhost 6666
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
hello
Doesn't work! - hello - The command should appear before
this.Connectionclosed by foreign host.

Thanks,

Shane

On 12/10/2007, Scott Ragen <[EMAIL PROTECTED]> wrote:
>
> "Shane Anderson" <[EMAIL PROTECTED]> wrote on 12/10/2007 09:45:02 AM:
>
> > Hi,
> >
> > I've removed the if statement that checks the hash so now the code
> > looks like this:
> > while (my ($client, $client_address) = $server->accept()) {
> >     $client->autoflush(1);
> >     my ($port, $packed_ip) = sockaddr_in($client_address);
> >     my $client_ip = inet_ntoa($packed_ip);
> >     my $stamp = &timestamp;
> >     print LOGFILE "$stamp - Client ($client_ip) connected.\n" if $DEBUG
> == 1;
> >     $client->recv($recv, 128);
> >
> > #if (exists($commands{$recv})) {
> > #       $client->send("Works!");
> > #    } else {
> >             chomp($recv);
> >         $client->send("Doesn't work! - $recv - The command should
> > appear before this.");
> > #    }
> > }
> It could be chomp is removing the newline, but not carriage return(?).
> Try instead of chomp this:
> $recv =~ s/\r\n//;
> or it may be ordered the other way, I can't remember:
> $recv =~ s/\n\r//;
>
> Regards,
>
> Scott
>
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to