> The difficulty is to make the clients aware of each other.

IMO the most difficult thing is to have a client connect to another one 
which is behind a NAT router or a firewall.
NAT routers are very very common these days.

> Until now my idea is keep a txt file on the server with RW rights where a 
> client will write its
> own IP when it enters the network and delete its own address when it 
> leaves the network.

Better to use a standard web server with a few scripts (PHP, ASP or even 
Delphi depending on the hosting possibilities).
One script will update the IP list, the other will download it. Use a 
timestamp in the list to clean it if a client doesn't do anything for some 
time.
Your client could use ICS HTTP client (http://www.overbyte.be) to 
query/update the webserver, using the script you'll design. Quite easy.

> 7. I estimate that the maximum number of users in this moment is 50000 and 
> rising (considering the
> number of downloads per day) so I think there won't be more than 20000 
> simultaneous connected
> users at a moment of the day.

With a webserver, you don't have persistant connections. So what really 
count is how many will query the server at the same time given the fact that 
the script accessing the file will execute during - for example - half a 
second. I guess you'll only have a handful of simultaneous connections to 
the server.

> This will generate a list of aprox 0.5MB which is too big.

You need 4 bytes per IP and probably 4 bytes for time stamp. This gives a 
list of 160 KB.
You can keep the time stamp in another file. So the size will be 80 KB for 
IP only.

> So if you have any better idea please let me know.

You can send only updates to the connecting client. The clients could say: 
"Hey server give me all changes since this time". This would dramatically 
reduce the size.

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be



----- Original Message ----- 
From: "Human" <[EMAIL PROTECTED]>
To: "Delphi-Talk Discussion List" <[email protected]>
Sent: Sunday, May 14, 2006 1:32 PM
Subject: designing a simple P2P application - server side


> Hello.
> I want to write a simple P2P module (for one of my existing applications 
> application) specialized
> in transferring small files (max 0.5 or 1 MB) but I would like not to keep 
> a central server.
> A P2P network without server is difficult to realize so I think I really 
> need a minimum central
> server.
> The difficulty is to make the clients aware of each other.
> Until now my idea is keep a txt file on the server with RW rights where a 
> client will write its
> own IP when it enters the network and delete its own address when it 
> leaves the network.
> Any client connected to the network will read that file to know who else 
> it present in the
> network.
> In this moment the clients won't need the server anymore. They connect to 
> each other directly and
> start the download.
>
> Items and issues:
> 0. The server is running Windows but it is not mine so I can't write my 
> own custom software
> (although I think they allow my to write and install small .Net 
> application on their server)
> 1. Every client must renew its IP (and timestamp) in the server's list 
> every at 3 hours
> 2. It must download a new IP list at every 20 minutes
> 3. The list must be small
> 4. What will happen if 2 clients will simultaneously try to write to the 
> list?
> 5. What happens when a client suddenly leave the network without deleting 
> its IP from the list
> (probably the list must be cleaned by a special utility)
> 6. Idea: when a client enters the network it can send a message to every 
> already connected client
> to inform them about its presence so they don't need to re-download the 
> list too often from the
> server.
> 7. I estimate that the maximum number of users in this moment is 50000 and 
> rising (considering the
> number of downloads per day) so I think there won't be more than 20000 
> simultaneous connected
> users at a moment of the day. This will generate a list of aprox 0.5MB 
> which is too big. So in
> order to decrease the download:
> -compression needed
> -more than a list is required
>
> So if you have any better idea please let me know.
>
>
> If I choose Christianity then the Islamic will say I'm a pagan.
> If I choose Islamic then the Buddhism will say I'm a pagan.
> If I chose Buddhism then the Jewish will say I'm pagan.
> If I choose no God then everybody will say I'm pagan.
> Please, can I be free? Can you NOT tell me how I should live MY life?
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> __________________________________________________
> Delphi-Talk mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi-talk 

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to