I'm working on a university project and I have to develop a P2P application consisting of client and server. When a client requests a file from the server, the server returns the list of clients who possess that file and the client connects to one of those clients and "downloads" it. The problem is that I can't use RMI registry, so I don't really know how to send the list of clients that possess the requested file to the client.
I mean, when a client connects to the server, it registers the file it possesses with the server, and the server should associate that file with that specific client.
When another clients asks for one of those files, the server returns a reference to the client that possesses the file and the clients invoke a remote method on that reference in order to get the file.
I know how to share remote references using RMI registry but I can't use it.
Does anybody have an idea on how can I do this?
preguntado el 24 de mayo de 14 a las 16:05
If you can't use the RMI Registry you essentially can't use RMI, unless there is a friendly LDAP server available, which doesn't seem likely, or unless you're allowed to use the COSNaming service, ditto.
You need to assign some unique name to each of the resources in question. There are many ways to do this, but the simplest for your purpose are URLs or UUIDs, which the client will send to the server. These take the place of remote references (references are just a kind of name, and their scope is too limited for what you describe).