I am building a chess program(as applet) and as application. It is currently 1 player, and so you play against the program, (and lose if you are me). I know I can use sockets to get 2 java programs to talk to each other, but when me and my mate tried it, I was unable to receive data(Strings), only could I send data. Something to do with my modem settings I think.
I had an idea, but not sure if its a good one or not. I've been able to get my applets/applications to write(via php) and read from a text file on the server for my website.
So in theory, player 1 can make a move, this will write something to the server, then player 2 (reading from server every 2 seconds) can wait for new data to be added, so when it sees it, then player 1's move will be played on player 2's pc. And after player 1 has made that move, it will start to read from server every 2 seconds, until player 2 has moved.
Its slightly annoying that each computer has to continuously read from the server, but I can't see anyway that an applet/application on one computer can push data to an applet/application on a different computer, without using sockets.
Is my idea any good? Or do you think it will be problematic? Thanks
Let me explain a little.... A POJO server runs normal Java programs so in theory if you have a single Java program, and you can start a user interface and call it player one, and then start another UI and call it player 2... its done.
You need to read up a little on it, but what you can do is make it only deliver just those UI forms to remote machines, so the actual chess engine is still on the server... your game will pop up out of the browser, and play just like the stad-alone program. No sockets needed... it does that stuff for you... just need to make the game and understand a POJO server.
"Johnny Kewl", you have previously been warned on multiple occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional, and this is your final warning. Adjust your display name to comply with the required standards prior to your next post.
Failure to comply will result in the removal of your account.
No, you cant use... Your theory was applied (at least once) before (in designing a chat applet & server.)
But i have another idea
How about declaring a static String property for the applet and can you pls try and see what will happen its value in the other applet (at your mate's browser) if that static String is changed (by you pushing a button) at your brower? [ November 26, 2007: Message edited by: Rachid Fydhan ]