Hi!
At first, sorry for my english.

I'm doing my best to show you some things.
These two concepts are the decentralized and centralized network plans.
I've implemented server/client applications with both concepts, and I can say the decentralized one is more difficult.
On google you can find some text to read under the keyword: "graph theory".
At first, with it, every client needs an opened port. Only then are other clients able to connect.
Then, it's truly hard to develop the network so that every client gets every line of data. Think of it: there is basically a graph: the network of the connected clients. (The nodes are the clients themselves, of course and the lines are the connections beetween them.) How can you find a path for the information that arrives by every client AND avoids circuits.
Of course it is not possible to connect every client to every other clients. It would mean too many connections. And also would mean lotsa slow clients.
Besides, it eats up much more bandwith, because you (as a client) might need to forward someone else's data, too. (in case you don't connect to every other clients) Look at that graph:
CODE
A -- + +-----D
\ /
C
/ \
B -- + + -----E
Here are there 5 clients. They connect through the C client. In other words, C is the gateway. All the data A, B, D and E are sending to each other is going through C.
Would you like to be the C client?
And there are more such problems you have to think of. It can more easliy be done with small networks. That's why I think the most powerful solution is like with Direct Connect or IRC.
There are servers which can be connected to each other in a quite small network. (not 1000000 users connect to each other, just 10-15 servers)
Summa summarum: such a network shouldn't be developed without the needed knowledge.
The second plan sounds more valuable.
I suggest you should use async sockets for the server, so you don't have to use many threads in the server. Basically, the socket sends a signal when it has incoming data, you don't have to check it explicitly. You can take a look at it in the java.nio package.
kl223
Reply