This was tested with Perl 5.8-RC2, I got now the 5.8 
release and will compile it for test! If you want to test 
is very simple, just make a socket srv and client and send 
something like "A\nA" from the client and see what it 
reads, 65,10,65 or 65,13,10,65. Remember this bug is for 
Win32.

I tested with
$ENV{PERLIO} = ":raw" ; 
and nothing (still RC2).

To get speed, here are my test script:

SERVER:
#!/usr/bin/perl $|=1; $ENV{PERLIO} = ":raw" ; sub SOCKET_init { $| = 1 ; use Socket;my $p=getprotobyname('tcp'); socket(SRV,PF_INET,SOCK_STREAM,$p); setsockopt(SRV,SOL_SOCKET,SO_REUSEADDR,pack('l',1)); my($opn,$try); while($opn!=1 && $try<=20){ if(bind(SRV,sockaddr_in($_[0],INADDR_ANY))){$opn=1} else{$try++;sleep(1)}} if($opn!=1){print"ERROR! Port $_[0] in use.\n";exit} listen(SRV,SOMAXCONN);my($wpid,$pad)=(0); $SIG{CHLD}=\&REAPER;my $CLT; for($wpid=0;&ACT_CLT;$wpid=0,close(NS)) { next if $wpid and not $pad;my($p,$a)=sockaddr_in($pad); my @i=unpack('C4',$a);$CLT++;$PORTS{$CLT}=$p; $IPS{$CLT}=join('.',@i);my $sl=select(NS);$|=1; select($sl);if($_[1]=~/^(1|ye?s?|si?m?)$/i){ &SPAWN($CLT)}else{&Server_DO($CLT)}} sub REAPER{$wpid=wait;$SIG{CHLD}=\&REAPER} sub ACT_CLT{return($pad=accept(NS,SRV)) || $wpid} sub SPAWN { my ( $CLIENT_id ) = @_ ; my $pid ; if (!defined($pid = fork)) { print "cannot fork: $!\n" ; return ;} elsif ($pid) { return ;} exit &Server_DO($CLIENT_id) ; } } sub Server_DO { # Your commands to do whe the client are connected: my ( $CLIENT_id ) = @_ ; print "New Client! <$CLIENT_id>\n" ; print "PORT: $PORTS{$CLIENT_id}\n" ; print "IP: $IPS{$CLIENT_id}\n" ; while( sysread(NS, $buffer , 3) ) { &BYTES($buffer) ; $var = "A\nA" ; print NS $var ; exit; } print "Client $CLIENT_id DOWN!\n" ; close(NS) ; } my $port = 2345 ; my $SRV_fork = 0 ; print "Sock Init\n" ; &SOCKET_init($port,$SRV_fork) ; # Start the server. exit; ######### # BYTES # ######### sub BYTES { my @d = split(//s , @_[0] ); foreach my $d_i ( @d ) { my $s = unpack("C", $d_i ) ; print "$s\n" ; } }
CLIENT:
#!/usr/bin/perl use IO::Socket ; $ENV{PERLIO} = ":raw" ; $|=1; my $port = 2345 ; my $host = 'localhost' ; my $sock = new IO::Socket::INET( PeerAddr => $host, PeerPort => $port, Proto => 'tcp', Timeout => 30 , ) ; if (! $sock) { die "ERROR! Ca'nt connect\n" ;} $sock->autoflush(1); print $sock "A\nA" ; sysread($sock, $read , 3) ; &BYTES($read) ; close($sock) ; exit; sub BYTES { my @d = split(//s , @_[0] ); foreach my $d_i ( @d ) { my $s = unpack("C", $d_i ) ; print "$s\n" ; } }

In reply to Re: Re: Perl 5.8 no :crlf on Socket!!!!!! by gmpassos
in thread Perl 5.8 no :crlf on Socket!!!!!! by gmpassos

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.