Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Server logic.
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Martin




PostPosted: Sun Oct 03, 2004 11:36 am   Post subject: 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?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Oct 03, 2004 1:19 pm   Post subject: Re: Server logic.

Martin wrote:

Now for my question: Is this the best way to go about it? Is there a better way?


use IRC Laughing
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
wtd




PostPosted: Sun Oct 03, 2004 2:02 pm   Post subject: (No subject)

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




PostPosted: Sun Oct 03, 2004 11:22 pm   Post subject: (No subject)

So I guess that I should learn about threads first then Wink
wtd




PostPosted: Mon Oct 04, 2004 12:08 am   Post subject: (No subject)

Threads in Java aren't that hard. Smile
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: