simple network game

H

Haris Bogdanovich

Hi.

I'm trying to implement a tic tac toe over network.
I have a Lisp server behind, where
I start a new session for each player.
How can I know that the other player played
and vice versa ?
Do I set a timer in Javascript (lets say to every second)
to do an Ajax call to the server
when something is played ?
Is that the common practice ?

Thanks
 
E

Evertjan.

Haris Bogdanovich wrote on 22 apr 2011 in comp.lang.javascript:
I'm trying to implement a tic tac toe over network.
I have a Lisp server behind, where
I start a new session for each player.
How can I know that the other player played
and vice versa ?
Do I set a timer in Javascript (lets say to every second)
to do an Ajax call to the server
when something is played ?

Now and again someone is trying to have us do their schoolwork.
Is that the common practice ?

Indeed, as I said.
 
V

VK

Do I set a timer in Javascript (lets say to every second)
to do an Ajax call to the server
when something is played ?
Is that the common practice ?

Alas it is. Javascript is still missing port listeners so peer-to-peer
is not available.

There is also so called "Comet technics", see
http://en.wikipedia.org/wiki/Comet_(programming)
but I would strongly discourage you from using it. By default browsers
have a narrow limit of simultaneously open HTTP channels. By
explicitly locking one of them one breaks the whole channels' load
optimization mechanics with strange effects to expect.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top