Gnutella Forums  

Go Back   Gnutella Forums > Gnutella News and Gnutelliums Forums > General Gnutella Development Discussion
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Today's Posts

General Gnutella Development Discussion For general discussion about Gnutella development.


 
 
LinkBack Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old October 8th, 2008
Novicius
 
Join Date: October 8th, 2008
Posts: 3
Atomical is flying high
Default Gnutella PHP,QRT example

I'm testing a PHP Gnutella client and I need to generate a QRT table so I can receive data and test the functionality. I read over the spec and I still can't figure this out or get it right. If anyone could shed some light on what I'm doing wrong that would be amazing! I suspect I'm not packing/formatting the binary data right. Here's my code:

PHP Code:
        //write QRP reset message
        
$variant "\0x0";
        
$table_length pack('V',65536);
        
$infinity pack('C',1);
        
$packet $variant $table_length $infinity;
        
$reset create_header"\30x0"1,0$packet );
        
        
fwrite($fp$reset,strlen($reset));
        
        
        
//4 kilobyte
        
$byte '';
        for ( 
$o 0$o 8/*(1024*4)*/$o++){
            
$byte .= 1;
            
//$byte .= bindec(1111);
            //$byte .= pack('C',1); 
        
        
}
        
        
        
//write qrp table
        
$packet '';
        for ( 
$t =0$t 16$t++ ){
    
            
$variant "\0x1";
            
$seq_no pack('C',$ttt $t+1);
            echo 
"Patch $ttt of 16\n";
            
$seq_size pack('C',16); //bits
            
$compressor "\0x0";
            
$entry_bits pack('C',8);
            
$packet $variant $seq_no $seq_size $compressor $entry_bits $byte;
            
            
$packet create_header("\30x0",1,0,$packet);
            
            

            
fwrite($fp,$packetstrlen($packet));
            
        
        } 
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 11:24 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.