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.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old November 22nd, 2007
Novicius
 
Join Date: November 18th, 2007
Posts: 4
helpfred is flying high
Default store information from txt file in array

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.
Reply With Quote
  #2 (permalink)  
Old November 22nd, 2007
Remoc's Avatar
TexAz
 
Join Date: July 4th, 2006
Location: Sweating in Az.
Posts: 2,906
Remoc has a spectacular aura about
Default

You might check with the TECH GEEK. He resides here. He is a "Computer Expert".

Make the message go away! ( 1 2)
__________________
I Don't Suffer From Insanity, I Enjoy Every Minute of it





Reply With Quote
  #3 (permalink)  
Old November 22nd, 2007
A reader, not an expert
 
Join Date: January 11th, 2003
Location: Canada
Posts: 4,613
stief has a spectacular aura about
Default

LimeWire Forums is another forum where your ideas might get a response from the LW programmers.
Reply With Quote
  #4 (permalink)  
Old November 23rd, 2007
arne_bab's Avatar
Draketo, small dragon.
 
Join Date: May 31st, 2002
Location: Heidelberg, Germany
Posts: 1,881
arne_bab is a great assister to others; your light through the dark tunnel
Default

IRC is also a good place to ask:
#gtk-gnutella at irc.freenode.org:6667
#phex at irc.freenode.org:6667
__________________

-> put this banner into your own signature! <-
--
Erst im Spiel lebt der Mensch.
Nur ludantaj homoj vivas.
GnuFU.net - Gnutella For Users
Draketo.de - Shortstories, Poems, Music and strange Ideas.
Reply With Quote
Reply


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 06:28 PM.


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

Copyright © 2020 Gnutella Forums.
All Rights Reserved.