Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (497)
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  
  tcp chat program, I don't like that i have to set up my router to forward ports  (Read 1436 times)
0 Members and 1 Guest are viewing this topic.
Offline wilburthemexican

Senior Newbie





« Posted 2008-02-12 00:12:24 »

i'm trying to right a tcp chat program i have it set up so that you can choos to be either the server or the client
the server is set up like this:

 ServerSocket srvr = new ServerSocket(port);
 Socket skt = srvr.accept();

and the client is set up like this:

Socket skt = new Socket(ipAdress,port);

It works running both on one computer using port 12345 and ip "localhost", and it works over internet using port 12345 and my public ip. But for it to work  over the internet i had to set up my router to forward port 12345 to my computer running the server.
how do i make it so that the program opens up a user defined port and forwards it to the server computer, so that users of the program only have to know the public ip of the server and the port. I don't know if that's how its supposed to work but that was what i was thinking. Thanks.
Offline ryanm

Senior Member


Projects: 1


Used to be bleb


« Reply #1 - Posted 2008-02-12 00:59:31 »

What you want is called "UPnP". It's a technology that most routers implement that allows applications to open ports and forward traffic automatically.

Google should be able to turn up Java implementations.
Offline noblemaster

JGO Ninja


Medals: 19
Projects: 9


Age of Conquest makes your day!


« Reply #2 - Posted 2008-02-12 21:58:16 »

In regards to UPnP, I found this: http://www.sbbi.net/site/upnp/docs/natmappings.html

You can use it to configure your router to redirect traffic. Does anyone have experience using UPnP? It sounds really cool, but I wonder (a) how well it works and (b) how many routers actually support it?

If anyone is interested, I write a small test program to see how well that works (you folks would have to run it though)?

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.

xsi3rr4x (14 views)
2014-04-15 18:08:23

BurntPizza (12 views)
2014-04-15 03:46:01

UprightPath (25 views)
2014-04-14 17:39:50

UprightPath (11 views)
2014-04-14 17:35:47

Porlus (28 views)
2014-04-14 15:48:38

tom_mai78101 (50 views)
2014-04-10 04:04:31

BurntPizza (109 views)
2014-04-08 23:06:04

tom_mai78101 (209 views)
2014-04-05 13:34:39

trollwarrior1 (177 views)
2014-04-04 12:06:45

CJLetsGame (184 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
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!