From f00c13dfbacb1f6e56163e17baa059b4d1d8050d Mon Sep 17 00:00:00 2001 From: "PSp..om" Date: Sat, 19 Mar 2011 05:22:47 +0000 Subject: [PATCH] Added a comment about the "magic number" used in the connect message from the client. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7034 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/network/base/DefaultClient.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engine/src/networking/com/jme3/network/base/DefaultClient.java b/engine/src/networking/com/jme3/network/base/DefaultClient.java index 417b0848d..92305bdf3 100644 --- a/engine/src/networking/com/jme3/network/base/DefaultClient.java +++ b/engine/src/networking/com/jme3/network/base/DefaultClient.java @@ -113,6 +113,16 @@ public class DefaultClient implements Client // Send our connection message with a generated ID until // we get one back from the server. We'll hash time in // millis and time in nanos. + // This is used to match the TCP and UDP endpoints up on the + // other end since they may take different routes to get there. + // Behind NAT, many game clients may be coming over the same + // IP address from the server's perspective and they may have + // their UDP ports mapped all over the place. + // + // Since currentTimeMillis() is absolute time and nano time + // is roughtly related to system start time, adding these two + // together should be plenty unique for our purposes. It wouldn't + // hurt to reconcile with IP on the server side, though. long tempId = System.currentTimeMillis() + System.nanoTime(); // Set it true here so we can send some messages.