I'd like to implement a simple chess peer to peer network application : one instance of the program may register friends player, and when one friend is "connected" (I mean both available by another program instance and registered as friend), I can ask him to play a game.
As I know J2SE language, as well as Swing framework, I tried to start coding, using Sockets. The problem is that I need a way to
- register my friends (or other accounts)
- get the friend ip, for creating a socket (it will be the same problem on the other side) : with the problem of dynamic ip adresses.I mean that a serialized adress may not be valid anymore
- be informed that the other side has "connected"
I think that first and third point can be resolved if I use a PHP server which will have all informations for all registered users.
This is how the application should work :
- First, before trying to connect each other, the users must register an account on a PHP server that I'll have to implement (with MySQL database)
- When launching the application, the user logins by giving its username and password. So that the application will be able to retrieve friends (and stats for example) thanks to the server
- When two friends are ready to play together, the server give all needed informations (such as ip adress) to both player application instance.
My main difficulties will be for the (de)serialization of dynamic IP Adresses, and for retrieving informations about a user on the PHP server.
What do you suggest ?