[Roma.pm] un piccolo problemino!

LordOfDeath webmaster.staff at gmail.com
Wed Apr 29 07:47:33 PDT 2009


Salve a tutti ragazzi!
volevo porvi un problema che mi si è creato...!

    my $test= 
IO::Socket::INET->new(PeerAddr=>"qualcheip",PeerPort=>"80",Proto=>"tcp", 
Timeout=>3);
    $test->autoflush(1);
    my $result;
    my $p;
    print $test 'POST /test.html HTTP/1.1' ."\r\n";
    print $test 'Host: '."qualcheip"."\r\n";
    print $tes t'User-Agent: veryprivateacsor' ."\r\n";
    print $test 'Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5' 
."\r\n";
    print $test 'Accept-Language: en-us,en;q=0.5' ."\r\n";
    print $test 'Accept-Encoding: gzip,deflate' ."\r\n";
    print $test 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7' ."\r\n";
    print $test 'Keep-Alive: 300' ."\r\n";
    print $test 'Connection: keep-alive' ."\r\n";
    print $test 'Content-Type: multipart/form-data; ' ."\r\n";
    print $test 'boundary=---------------------------41184676334' ."\r\n";
    print $test 'Content-Length: 234' ."\r\n";
    print $test '' ."\r\n";
    print $test '-----------------------------41184676334' ."\r\n";
    print $test 'Content-Disposition: form-data; name="config.x"' ."\r\n";
    print $test '' ."\r\n";
    print $test '' ."\r\n";
    print $test '-----------------------------41184676334' ."\r\n";
    print $test 'Content-Disposition: form-data; name="config.y"' ."\r\n";
    print $test '' ."\r\n";
    print $test '' ."\r\n";
    print $test '-----------------------------41184676334--' ."\r\n";
    print $test ' ' ."\r\n";
print "vai col while\n";


    while($line=<$test>){
            $result.=$line;
    print $result;
        }

close ($hack);


avendo queste righe di codice in una sub, ogni tanto mi succede questo: 
la socket rimane in attesa di un'eventuale risposta dell'ip che però nn 
arriva, e la sessione non cade in timeout, quindi rimango ad 
aspettare... per mooooolto tempo! e non capisco il motivo.. per cui mi 
chiedevo se c'è un modo per prendere il l'output da una socket dopo uno 
sleep di qualche secondo... è un modo 1 pò grezzo, però altrimenti mi si 
inchioda tutto!

grazie in anticipo :)



More information about the Roma mailing list