4

First off, I am VERY new to Java, but wanted to know if it was possible. I could not find any tutorials or explanation online:

Is it possible to send/receive files not through a server, but P2P. I want a file, when selected, to be sent to another PC running the client. What is the best method of doing this? Is there something I have missed?

(P.s. My first stackoverflow question, please be nice :D)

Piyush Mattoo
  • 15,454
  • 6
  • 47
  • 56
3lionz
  • 43
  • 1
  • 5
  • Sure, it's possible. But generally firewalls make it difficult/impossible to do so, especially if either client is behind a NAT gateway. – Marc B Sep 08 '11 at 17:57
  • Search here on SO for P2P + Java. There are a lot of questions and answers already. – Perception Sep 08 '11 at 17:58

5 Answers5

3

Give JXTA a try, it should satisfy all your needs.

Or try a DHT implementation for the P2P part and implement the file transfer either over the DHT or just the sesssion initiation by DHT and some other kind of direct file transfer.

(DHT selection taken from this question)

Community
  • 1
  • 1
flob
  • 3,760
  • 2
  • 34
  • 57
  • Thank you for the help :) Although I find the 170 page guide very daunting, I will definitely be having a look at JXTA. Do you have any particular resources/tutorials that helped you start off?(Link for any others out there: http://www.javaworld.com/javaworld/jw-05-2005/jw-0509-jxta.html?page=1) – 3lionz Sep 09 '11 at 14:58
  • This one looks good, http://www.ibm.com/developerworks/wireless/library/wi-jxta/ but I have no particular HowTos i would recommend, sorry :/ – flob Sep 09 '11 at 15:04
0

Pastry provides a DHT. Its done Java and very easy to use. Its storage system is known as PAST and a tutorial can be found here : https://trac.freepastry.org/wiki/tut_past

I've had a great experience working with it.

Travis
  • 705
  • 6
  • 30
0

Maybe you want to have a look at http://www.adp-gmbh.ch/blog/2004/november/15.html

Every Peer in a P2P-system will have both roles (receiver AND sender that is each peer is server AND client at the same time).

ashiaka
  • 3,994
  • 8
  • 32
  • 45
0

It is certainly possible. Check the Free Pastry implementation

Piyush Mattoo
  • 15,454
  • 6
  • 47
  • 56
0

JXTA are a little complex to someone new in Java and it has some limitations with scalability and perfomance of his communications layers. Another option is XMPP, if a pure P2P is not mandatory.

Thiago Vieira
  • 126
  • 4
  • 16