0

I plan to write an network application whose use steps is the following :

  1. Connect to the server and choose a name (and enter your email "id")
  2. The list of others "free" (not playing a game) players is shown to you : so you have to select one.
  3. The server use the two players ip adress in order to connect them

But I think I will be facing a great issue :

  • how to handle dynamic ip adress carefully : can a dynamic ip adress change while the established connection is not yet finished ?
  • if yes, how must I handle that, let's with Java 7 for example ?

Regards

2

Once someone has been assigned an IP it will not change until they log off (basically). So yes it can - in between getting a list of users and selecting one to play with, the person on the other end might disconnect, or be disconnected, or log off, or suffer a power cut or any other reason why they may no longer be available to play.

So you simply need to ensure that the person selected is still available when selected, so just attempt a connection and handle failures. The IP address will not change between the discovery and selection process so you don't need to worry about making connections to some random person, not unless the time between the 2 steps is very long.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.