Well the procedure is -
GNUTELLA CONNECT/0.4\n\n
you should get back
GNUTELLA OK
At this point you are connected. Usually I send a ping right after I receive the "GNUTELLA OK" message. After that you will be reading (and usually writing) data from the socket/connection. Initially, I just read all data in and printed it (however you want - hex, decimal, ascii). Later on, I wrote functions that would read and parse this data. After you send the ping you may receive pongs, queries, and sometimes misdirected or bad packers (misdirected queryhits and pushes, which you shouldn't get since you hadn't sent or forwarded anything aside from a ping, or possibly bad packets). |