"Snuyt" <sn**********@skynet.be> wrote...
You are correct. During the seconds to wait, clients should indeed be
able to send chatmessages to the server. But how would you implement the
wait then ?
Hi again. You keep describing it as "waiting" ... the server isn't waiting
it is "serving" that's all it does. It isn't serving the "deal the cards"
message, but it is serving other messages. Look at it this way. If you
wanted the server to broadcast the message "it's 10 pm" at 10 o'clock then
you would set a timer for 10pm and an event handler would fire that message
off. If instead you want a "deal the cards" message to be broadcast 10
seconds from now you can set a timer for that.
Alternatively (or perhaps in combination) you could put the "game" into a
state. It would be in "showing final hands" state. The timer would then
reset the state to whatever state was next like "deal the cards state." The
point is that the server wouldn't be asleep it would be broadcasting (and
receiving) whatever messages were appropriate for "showing final hands"
state.
You can choose not to broadcast anything of course but you can also choose
to send messages about the big tournament the following week or a message
that "Eddie has left the game." These messages wouldn't affect the display
of the cards on the screen, people can still view them.
To answer your question... somehow the server determines when it wants to
broadcast the "deal the cards" message then it keeps an eye on the clock.
Rather than polling (which would work) an event turns out to be a
good/better mechanism.
Tom