Results 1 to 2 of 2
Thread: Multiplayer in localhost
- 12-04-2017, 07:57 PM #1
Senior Member
- Join Date
- Nov 2016
- Posts
- 163
- Rep Power
- 5
Multiplayer in localhost
I have downloaded XAMPP and I use localhost.
Can I make my program accessible for someone who isnt using my network?
I mean : other user from diffrend city, could connect to my program and use it?
Java Code:import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.input.KeyCode; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; public class JAVAXx extends Application { int x = 0; int y = 100; @Override public void start(Stage primaryStage) { Rectangle myHero = new Rectangle (50,50); myHero.setTranslateY(100); Group multipleComponents = new Group(); multipleComponents.getChildren().addAll(myHero); Scene scene = new Scene(multipleComponents, 600, 400); primaryStage.setScene(scene); primaryStage.show(); scene.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.W) { y -= 20; myHero.setTranslateY(y); } if (e.getCode() == KeyCode.S) { y += 20; myHero.setTranslateY(y); } if (e.getCode() == KeyCode.A) { x -= 20; myHero.setTranslateX(x); } if (e.getCode() == KeyCode.D) { x += 20; myHero.setTranslateX(x); } }); } public static void main(String[] args) { launch(args); } }
- 12-04-2017, 11:33 PM #2
Senior Member
- Join Date
- Jan 2013
- Location
- Northern Virginia, United States
- Posts
- 6,226
- Rep Power
- 15
Re: Multiplayer in localhost
The localhost address is simply the loopback address of the PC one is using. So it doesn't make sense to me to have some access
that address from outside. But I am not familiar with the app and how its used. normally, to let someone access your laptop remotely
you need to:
1. Provide them the ISP side address of your LAN.
2. Ensure any required ports are not blocked by your router or ISP.
3. Ensure the PC is listening for incoming traffic on that port.
4. And you will need to direct traffic for the specific port to a specific IP address since otherwise the
router will not know to which IP to forward the traffic.
Regards,
JimThe JavaTM Tutorials | SSCCE | Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
Similar Threads
-
2D Multiplayer
By AlexGraal in forum Java GamingReplies: 4Last Post: 04-30-2014, 10:28 AM -
multiplayer LAN game
By ethomas92 in forum NetworkingReplies: 1Last Post: 12-14-2012, 09:54 PM -
Multiplayer (one on one) how is it done?
By überfuzz in forum AndroidReplies: 0Last Post: 07-18-2011, 12:00 PM -
Multiplayer Bingo game
By js4learn in forum Java GamingReplies: 1Last Post: 07-08-2011, 04:43 AM -
Multiplayer lobby
By OrangeDog in forum Advanced JavaReplies: 6Last Post: 09-30-2009, 09:12 AM
Bookmarks