Search code examples
p2ppeer

implementing p2p program


hi i have an assignment in school to write a p2p program, and i am trying to understand the idea behind it. we were told to implement two objects FileManager and NameServer:

A FileManager maintains a set of files. It allows its users to remove\rename existing files and to obtain new files from other FileManagers. On startup, a FileManager F receives as input its list of files and a list of NameServers. Then, F sends its list of filenames and NameServer names to all the NameServers on its NameServers’ list

A NameServer maintains information about which files are stored in each of the known FileManagers. The NameServer also helps to distribute between FileManagers information about other NameServers.

so i am have a hard time understanding the interaction between these two objects. do they both run on the same machine? i mean, in p2p each machine function as a server. i am sorry if the question is a bit unclear as the whole assignment is still a bit unclear to me. can anyone try to help me understand?


Solution

  • so i am have a hard time understanding the interaction between these two objects. do they both run on the same machine? i mean, in p2p each machine function as a server.

    It means you have two types of nodes on your P2P system, functionally/logically speaking. Some acting as FileManagers and some acting as NameServers. Eventually, a real node may implement both sets of functionalities and act both as a FileManager and NameServer at the same time.

    You can see FileManagers and NameServers as services offered by peer instances. Hope this helps.