
-----------------------------------
Martin
Sun Oct 03, 2004 11:36 am

Server logic.
-----------------------------------
My current project right now is to create a multi-user chat program in Java, to figure out all of the net commants. The ultimate goal that I have is to make an online game.

My question is: what is the logic behind creating a client-server model?

I would assume that much of it relies on faith that the package gets to the server or client, but right now, here is my plan:

Client connects to server.

When connected, server sends a message to the client saying that it is connected.

Every minute, the server will ping all clients, and if they do not reply, they will be disconnected.

When a client sends a message, it sends it to the server, and the server replies that it got it. The server then sends the message to all of the other clients, which then reply to confirm that they recieved the package. If there is no reply (over an undetermined time frame), the server will try again. If there is again no reply, that client is disconnected.

To disconnected, the client simply tells the server that they are disconnecting. If the server doesn't get it, they will be automatically disconnected in the next ping sweep.

Now for my question: Is this the best way to go about it? Is there a better way?

-----------------------------------
Tony
Sun Oct 03, 2004 1:19 pm

Re: Server logic.
-----------------------------------

Now for my question: Is this the best way to go about it? Is there a better way?

use IRC :lol:

-----------------------------------
wtd
Sun Oct 03, 2004 2:02 pm


-----------------------------------
Keep in mind that you'll want to use threads in your server at least so that multiple clients can connect and communicate with it simultaneously.

-----------------------------------
Martin
Sun Oct 03, 2004 11:22 pm


-----------------------------------
So I guess that I should learn about threads first then ;)

-----------------------------------
wtd
Mon Oct 04, 2004 12:08 am


-----------------------------------
Threads in Java aren't that hard.  :)
