Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  MatchMaker + Routers/NAT firewall  (Read 1745 times)
0 Members and 1 Guest are viewing this topic.
Offline darkprophet

Senior Devvie

Go Go Gadget Arms

« Posted 2005-07-20 17:42:32 »

Ive made this servlet that gets the IP and port of a game server and store it in an XML file. When a client wants to see the list of servers on, they simply get the xml, process it...etc and join.

However, if the server is going through a router, the server is started at one port, and the router routes that port to another one that the server doesn't know. Does anyone know of a way to either detect the actual forwarded port of the server, or go round the router via some code?

Any help is appreciated.

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline Alan_W

JGO Knight

Medals: 8
Projects: 3

Java tames rock!

« Reply #1 - Posted 2005-07-20 19:07:40 »

This looks similar to the problem I've been chewing on (& had some good feedback from Jeff in another thread).

I assume your game server opens a connection to the servlet to inform it of it's existence.  The servlet can then tell users all the servers that have registered with it.

If I got the above right, then the server (when behind a router) needs to open a known port on the router so as to be able to accept incoming connections from perspective clients.  This either means port forwarding on the router (in which case you have a known port open on the router to accept incoming connections), or you can use UDP punchthrough.  UDP punchthrough avoids manual port forwarding, but does need an Introducer application running at a known address to make the concept work.

My (buggy) Introducer listens on a known UDP port.  Prospective clients send a packet to this port and are sent in turn a list of other clients that recently talked to the port (I'm doing peer-peer hopefully).  However the Introducer could just as easily return a list of servers - The packet sent to the introducer just needs to identify whether it is a server or client request.   Servers (run on home computers, possibly with routers) send a packet to the Introducer to register.  The UDP port on the router is held open to allow the Introducer to reply.  However you can send to that port from anywhere on the net & it will route though to the server.  This is UDP punchthrough.  Since the Introducer knows what this port is, and can give it to prospective clients, the problem is solved.

NB. The server needs to ping the Introducer at regular intervals (1Hz?) to i) Keep the UDP routing alive in the router, ii) Keep the listing alive in the Introducer.

NB.  I have this sort of working, but haven't tried it through a router yet to see if the UDP punchthrough actually works (meaning whether I have understood & coded it right)

Not sure whether this answers your query. Sorry if I've totally missed the point  Wink


Time flies like a bird. Fruit flies like a banana.
Pages: [1]
  ignore  |  Print  

EgonOlsen (44 views)
2018-06-10 19:43:48

EgonOlsen (24 views)
2018-06-10 19:43:44

EgonOlsen (46 views)
2018-06-10 19:43:20

DesertCoockie (201 views)
2018-05-13 18:23:11

nelsongames (126 views)
2018-04-24 18:15:36

nelsongames (125 views)
2018-04-24 18:14:32

ivj94 (866 views)
2018-03-24 14:47:39

ivj94 (127 views)
2018-03-24 14:46:31

ivj94 (770 views)
2018-03-24 14:43:53

Solater (142 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!