If I wanted to make a card game between two people to be played over the internet, which is better, client/server or peer-to-peer? Are there other alternatives?
If I wanted to make a card game between two people to be played over the internet, which is better, client/server or peer-to-peer? Are there other alternatives?
P2P sounds good.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I'd be interested to hear of any OTHER solution. Either you have a client that connects to a server. This was in the less politically correct days called "master & slave", but now that politically correct ways have taken over, we mustn't say that.
Peer-to-peer is where neither is "master" (server) or "slave", but they are "equal" (peers).
I agree that P2P is probably fine.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Warning: Have doubt in anything I post.
GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101
I've written only one small client/server program before and I'm not sure how peer-to-peer is different. I guess I'm lost in the nomenclature itself. For instance, where do sockets fit into this? It's beginning to look to me that the client/server and peer-to-peer both use sockets and are different only in the structure of the program itself. Is that right? Also, on Windows XP are there any higher-level solutions than sockets?
P2P comes in essentially two flavors, pure and hybrid.
A pure P2P isn't dependent on any servers. The nodes communicate with each other thru a mesh. A mesh is a named discoverable self maintaining set of nodes that an application must first join to engage in P2P.
A hybrid P2P uses one or more centralized servers to act as routers and dispatchers to the various nodes. Each server will have specialized responsibilities such as notifying a node where another node is located or where the node can find a particular file etc. Examples of hybrid P2P would be Napster, BitTorrent etc. This was Napster's downfall. A centralized server made it vulnerable to legal attacks from the recording industry. With a major stretch of the imagination, a hybrid P2P can almost be considered a client/server network.
An example of a pure P2P would be Gnutella (clones) with no central server providing any services. Thus, no specific target for the recording industry legal beagles.
The P2P networking stack is not installed on Windows XP by default. So, you'll have to install. One requirement is that you must have XP SP2 installed.
The architecture used by MS for P2P networking is the Winsock API and the Crypto API. Thus, you are using "sockets".
Getting back to your two person card game, you might consider an application that is both a client AND a server. That is, each person would use the app which is both a client and a server to play the game which will eliminate the "server in the middle". After all, if you look look at pure P2P, each node in it's most base form is nothing more than a client and a server.