Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am preparing to start a 3rd year project using Java. The object is to create a P2P application where users can write text, draw and edit at the same time. The connection between them must be P2P.

At this point I still don't know details about design etc. and I'm just doing some reading. I have made a simple network application before but that was clients/server.

What should I look into in order to understand how to create a P2P network? Do I need to use JXTA or, for a small scale application, it's better to make my own protocol?

PS. I posted the same question on Stack Overflow, but it was closed. Hope this is a better place for it.

Update

JXTA proved a bit too complicated for my needs. As a result I ended up using JGroups, which proved very simple to work as well as efficient enough for my needs.

share|improve this question
    
Quick question, are you able to use Java 7 for this? –  Martijn Verburg Sep 6 '11 at 8:46
    
Uhm there isn't a restriction as far as i know not to use java 7 . –  latusaki Sep 6 '11 at 9:23
    
+1 for the update. Out of curiosity, have you taken a look at Azureus (which is in Java and open-source)? That's what I would have done if I were you. Do you know how it is implemented? –  Konrad Morawski Jul 19 '13 at 11:09
    
I do not recall this name, I believe I did not see when when I was looking for libraries. –  latusaki Jul 19 '13 at 18:51
add comment

2 Answers

up vote 0 down vote accepted

I'm not an expert in this area but from what I can tell:

If you're using Java 6 and below then it looks like a good place to start is JXTA, there seems to be lots of resources out there for working with it.

If you can, it's worth looking at Java 7 as it's support for P2P programming is much improved. Sockets and Channels are now married together in the NetworkChannel interface, and things like multi-casting have much better support. Java 7 supports Asynchronous Sockets/Channels and you can group them. A good place to get an overview is in the Javadoc

I'd suggest starting with a 2 peer network and see if you can get them exchanging simple messages (perhaps over UDP/TCP), then prototype in a 3rd node. Once you've got the 3rd node in you've got a handle on the N-node case, and the serious design work can start from there.

share|improve this answer
    
ok thanks ill take a look on java 7 now –  latusaki Sep 6 '11 at 11:12
add comment

There isn't much to understand about peer-to-peer that you don't already know if you have programmed client-server systems. The one big difference is that every instance of the program runs the server code as well as the client code. The usual reason for switching to P2P is to indrease overall throughput or efficiency, but if it's only about user-generated text and drawings, you're not dealing with the amount of data that would require especially efficient protocols. What you should consider is just what your policy for sending updates to the participants are.

share|improve this answer
    
So you suggest that for my case what is probably better is making my own protocol ?(using a server i guess for finding peers) –  latusaki Sep 6 '11 at 9:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.