![]() |
|
Register | FAQ | The Twelve Commandments | Members List | Calendar | Arcade | Find the Best VPN | Today's Posts | Search |
General Gnutella Development Discussion For general discussion about Gnutella development. |
| LinkBack ![]() | Thread Tools ![]() | Display Modes ![]() |
|
| |||
![]() Hi, So i have been trying to simulate a gnutella network with query and queryhit, this is what i have so far. I have a txt file containing these information: 1,781,573,948 2,872,779,332 3,361,502,328 . . . . 999,725,446,280 1000,848,451,759 so basically 1000 lines (it represent nodes, with 3 nighbours) I need to read this txt file and store this file in an array, also i have another txt file conatins information like this: 1,6 2 3,1 . . . 999,5 1000,7 so again nodes but this time with resources so 1000 is a node and 7 is a resource. basically what i have to do is, query say node 1 to see if it has a resource of 6 in this case it has so ignore this one, so say query to node 2, as it dosent have resource 6 so now to look at its neighbours this information is then looking at the first file to see its neighburs: I am trying to similate a gnutella network with just query and queryhit with ttl3 and ttl4. so here is the code i have so far. Code: #include <iostream> #include <fstream> #include <cstdlib> using namespace std; int main () { ifstream inputFile; inputFile.open("Network.txt"); if (!inputFile) { cout << "Error opening file!" << endl; exit(1); } int data[1000]; // this line is Appended int node; int i=0; ////////// here is the code in which to put the elements of the file into the data array. while (!inputFile.eof()) { // keep reading until end-of-file inputFile >> node; data[i++] = node; } inputFile.close(); return 0; } As this is my first programming task i have no idea whether i am doing this right. If anyone can tell if i am on the right direction that would be great, or if you could point me to the right direction. Thank you. |
| |