Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 1026 times)
0 Members and 1 Guest are viewing this topic.
Offline darkprophet

Senior Member




Go Go Gadget Arms


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

Hi,
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.
DP

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

Alan

Time flies like a bird. Fruit flies like a banana.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

BurntPizza (18 views)
2014-09-19 03:14:18

Dwinin (34 views)
2014-09-12 09:08:26

Norakomi (62 views)
2014-09-10 13:57:51

TehJavaDev (84 views)
2014-09-10 06:39:09

Tekkerue (42 views)
2014-09-09 02:24:56

mitcheeb (64 views)
2014-09-08 06:06:29

BurntPizza (47 views)
2014-09-07 01:13:42

Longarmx (35 views)
2014-09-07 01:12:14

Longarmx (39 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!