thecerial has asked for the wisdom of the Perl Monks concerning the following question:

Hi, i run a phex as supernode on my ip and then i am trying to

connect to it using the following code:

my $header = 'GNUTELLA CONNECT/0.6' . LF; $header .= 'User-Agent: JTella 0.8' . LF; $header .= 'X-Ultrapeer: False' . LF; $header .= 'X-Ultrapeer-Needed: True' . LF; $header .= 'Remote-IP: 91.90.90.90' . LF; $header .= LF . LF; my $ultra_peer_host = '2XX.X02.XXX.XXX'; # '127.0.0.1'; my $ultra_peer_port = '59970'; #'59970'; $socket = new IO::Socket::INET( PeerAddr => $ultra_peer_host, PeerPort => $ultra_peer_port, Proto => 'tcp', Type => SOCK_STREAM, Timeout => 5 ) or die "can't connect to $ARGV[0]:$ARGV1: $@\n"; #$socket->autoflush(1); #$socket->blocking(0); print $socket $header; while (sysread($socket , $byte, 1) == 1) { print STDOUT $byte; } print $buf . " +++ \n";

but this doesn't work.

does someone know a solution? then please post it here!

thanks a lot.

Edited by planetscape - added code tags

( keep:0 edit:5 reap:0 )

Replies are listed 'Best First'.
Re: Gnutella - Perl implementation problems
by rowdog (Curate) on May 14, 2006 at 13:20 UTC
    As far as I can tell, IO::Socket::INET doesn't use TimeOut for anything (it's all commented out in version 1.31). One alternative might be to use the alarm signal in an eval block.