Im working on a p2p file sharing network (in C#) but im having
problems in my conflict resolution ( for 2 clients requesting the same
file. )
My Network Architecture is some thing like this :
A Central Server :
It is the starting point of my network . All auxillary servers
register their local IPendpoints here . These IP End Points are given
to incoming Client s .. so they can then connect to that specific
auxillary and join the network .
It will also house the central database(read on) which will host all a
list of all files on all clients .
An Auxillary Server :
Each auxillary has 3 (can be increased) local ports on which it waits
for incoming client requests . Once a client gets connected to the
auxillary it sends it , its file list . (Thus the auxillary maintains
a file list of all clients connected to it. {Not sure if i should do
this ?? } ) .
The auxillary also .. always maintains 1 connection always with each
of its clients .
This is not the case for the server . Every time the Aux. and the
central need to communicate a new TCP connection is started .
A Client :
A client first gets itself an auxillary from the central and then
stays connected to it through out its life time / or until it
disconnects from the auxillary.
[ALL this is DONE ]
Now I cannot figure out whether only the central should host the
database or also each of the auxillaries .
What i had thought of was :
The central maintain the Database . Every time a client need to search
for a particular file on the network .. it tells its respective
auxillary which then returns a file list (from the central) with IP's
of all clients having that file . Then that client chooses a file from
that file list .. again tells the server that ; that particular file
is going to be downloaded so remove it from the Database (so that no
one else can search for it} . It then directly connects to the other
client having that file and starts transfer .
This seems fine but has a lot of problems . To start with what if 2
clients on 2 different auxillaries request the same file . Both will
start downloading it coz both will assume that the server will remove
its entry from the database .
Secondly what if a particular client A has 3 files 1,2,3 . Client B
starts downloading 1 , client C starts downloading 2 . 3 's entry will
still exist on the server ; but there will be no outgoing connections
left on A ( each client has only 2 outgoing connections . ) for a
client D who wishes to download that file .
I wish to implement the protocol with least amount of data exchanged
between all 3 programs !!
ANY IDEAS ?? pls help