in reply to IO::Socket vs. Socket vs. off-the-shelf telnet

Hello

Is CRLF defined anywhere in your program? I can see that this is the source of trouble since you are chopping the EOL char and placing CRLF in its place. I tried this and it works as advertized:

use IO::Socket; use constant CRLF => "\r\n";##### Add This my $quit = 0; my $port = 12345; my $socket = IO::Socket::INET->new( Listen => 20, LocalPort => $port, Timeout => 5, #60 * 60, Reuse => 1) or die "No socket: $!"; warn "listening on port $port...\n"; while ( !$quit ) { next unless my $session = $socket->accept; my $peer = gethostbyaddr($session->peeraddr,AF_INET) || $session->peerhost; my $port = $session->peerport; warn "Connection from [$peer,$port]\n"; while(<$session>) { #BLOCKS HERE $bytes{'in'} += length($_); chomp; my $msg_out = $_ . CRLF; $session->print($msg_out); print $msg_out; $bytes{'out'} += length($msg_out); } warn "Connection from [$peer,$port] finished\n"; close $session; }
Aziz,,,

Replies are listed 'Best First'.
Re: Re: IO::Socket vs. Socket vs. off-the-shelf telnet
by adamsj (Hermit) on Aug 13, 2001 at 00:13 UTC
    Thanks for your answer. Unfortunately for me, I started the program off with:
    use strict; use IO::Socket qw(:DEFAULT :crlf);

    so I think that's not the answer. Still, I'm going to try setting the constant manually and see what happens...

    <INTERLUDE DURATION=BRIEF>

    Dum-de-dum-de-dum-dum.

    <\INTERLUDE>

    Nope, no such luck. Any more thoughts?

    adamsj

    They laughed at Joan of Arc, but she went right ahead and built it. --Gracie Allen

      Hello again

      There seems to be some inconsistencies between active-state perl and perl-5.6.2 I downloaded and built on my gnu/linux box. The client and server programs worked perfectly here.

      I really don't know what could the problem be.

      Aziz,,,