I have a project on peer-to-peer file transferring...Now I don't have any clue how I can use just the IP address of a computer to search for files in different drives...I have used socket object to create clients...now I have the info of only IP address and port number of a client. I need to search other clients' hard drive for particular files that the client selects...
Is there any built-in java method or how can I develop a mechanism to do so?
please guys, if you do have a solution, let me know...
My deadline is approaching...

Thanx in advance for your time...


Hi Everyone,

Streams is the answer.

You have to have a folder(easier than searching the entire hd) then send a list and the other side gets it and do the appropriate transfer.

ps: You have to create your own format of data packets for transfer

Richard West

hmm, I think he wants far more.
He seems to want to get a complete directory structure of someone's harddisk (with all files involved) from a remote location.
That is (happily) impossible.

What is possible is asking a program on the other computer (in a P2P environment you'd have programs running on both computers after all) for a specific file and have that program search for it.


Let me make the point clear. I need to build a peer-to-peer file transfer system, where a client uses a program to enter a search string and the server checks the other clients' computer for that file. The security measures will be considered later. First I have to develop the basic system.

My point is now how I can search in other computers using only the socket information. Of course, the client whose PC is being searched, agrees to proceed by logging in to server.

It is one of our 3r year projects. Now I am asking for a feasible mechanism to implement the searching and then begin transferring. Can you help me with some idea or any hint that I can use...

Now one thing that came to my mind after reading your posts is that if I send every client a thread containing the search string, then the thread will search its localhost drives for a match..then it can send the result back to the server. Is it possible to implement? Then I have to develop a local searching mechanism and then worry about transferring the file. Will the thread be able to transfer the file to server or other PCs? :eek:

Thanks a lot guys for replying...Looking forward to hear you...


You don't do it like that.
Either you have each client send a complete description of their filesystems to the server when first signing up and later regular updates and do all the searching on the server OR (and that's the best way) you have the server marshall the requests and have each client perform the actual search and send the results back to the server for return to the client initiating the search.