LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: Multiplayer dont work without local :/  (Read 2008 times)

Lucasnonime

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
Multiplayer dont work without local :/
« on: October 26, 2016, 16:36:41 »

First off sorry for my English :>

I am developping a java 2D game with lwjgl in multiplayer. I followed the vanZeben's tutorials about multiplayer (https://www.youtube.com/watch?v=l1p21JWa_8s). All is fine in localhost connection. (i'm using the port 1331).
Now i try to connect with friends but nothing :/. I changed the localhost here
socketClient = new GameClient(this, "localhost");
by my ipV6, i tried ipV4 too, i tried to connect with Hamachi but nothing at all..
I forwarded my ip (i think oO) following to this: https://www.youtube.com/watch?v=dXxdpfBxCRI
Nothing, nothing and nothing.
If someone can explain me how to do it.. thanks you  ;D
Logged

seventh-chord

  • Newbie
  • *
  • Offline Offline
  • Posts: 15
Re: Multiplayer dont work without local :/
« Reply #1 on: October 26, 2016, 18:44:04 »

It seems like you are hardcoding the IP address. You really should find some way to have your friend enter the address when he wants to connect, either using an ingame menu or a command line parameter. That will make it a lot easier to try out different addresses. Also, have you tried connecting from another location within the same network, without the need for port forwarding?
Logged

Lucasnonime

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
Re: Multiplayer dont work without local :/
« Reply #2 on: October 26, 2016, 19:04:26 »

Quote
Also, have you tried connecting from another location within the same network
How am i suposed to do that ? oO With Hamachi? Wait maybe you dont know what is Hamachi, i'm french and maybe its a french software ^^
Logged

seventh-chord

  • Newbie
  • *
  • Offline Offline
  • Posts: 15
Re: Multiplayer dont work without local :/
« Reply #3 on: October 26, 2016, 19:52:35 »

I have heard about hamachi, but what I was thinking about is something different. When you have two computers connected to the same local network (Same router) you do not need any port forwarding or fancy tools. You simply use the local ipv4 address of the computer you try to connect to. Your OS will have some tool for finding this address (ipconfig on windows, ifconfig on linux). For example, all computers connected to the same router as me can reach my computer at 10.0.0.89. This will not work with your friends on a different local network, but it is a good way of testing if the game actually works.
Logged

Lucasnonime

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
Re: Multiplayer dont work without local :/
« Reply #4 on: October 26, 2016, 20:35:37 »

So Hamachi permite that u_u. I arleady tested, nothing different without or with it.
Edit: just understood your message xD. " thinking about is something different " What is this ? ^^. I
"if the game actually works." It works, in localhost i can connect multiples accounts
Logged

Lucasnonime

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
Re: Multiplayer dont work without local :/
« Reply #5 on: October 28, 2016, 15:45:37 »

someone ?  :(
Logged

bobjob

  • Prolific Timewaster
  • ****
  • Offline Offline
  • Posts: 394
  • LWJGL: WOW SO GOOD
Re: Multiplayer dont work without local :/
« Reply #6 on: October 29, 2016, 08:24:29 »

what Operating system are you running it on?

Once you answer that, I can explain how to find your local IP address. Once, you find your local IP address, you can put that address in as long as your friend is on the same local network.

socketClient = new GameClient(this, <<PUT YOUR LOCAL IP ADDRESS HERE>>); //DO NOT PUT LOCAL HOST ON YOUR FRIENDS COMPUTER

It gets a bit more tricky trying to connect over the internet.
Logged

Lucasnonime

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
Re: Multiplayer dont work without local :/
« Reply #7 on: October 29, 2016, 10:05:41 »

I am on windows and i know i must not put localhost to connect with my friends --"
Logged

Lucasnonime

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
Re: Multiplayer dont work without local :/
« Reply #8 on: October 29, 2016, 17:11:18 »

I am on windows and i know i must not put localhost to connect with my friends --"
Quote
in as long as your friend is on the same local network.
If that mean i can connect with hamachi that's ok for me.
Logged

bobjob

  • Prolific Timewaster
  • ****
  • Offline Offline
  • Posts: 394
  • LWJGL: WOW SO GOOD
Re: Multiplayer dont work without local :/
« Reply #9 on: October 30, 2016, 03:33:20 »

In this youtube video at 12 seconds he points to the IP address on his computer. Open up that application to find out yours.

in his version it is "25.1.23.38" you need to find out yours and use that number instead of "localhost".

Connect to your own computer using your hamachi IP. If it works on your own machine and not your friends, the problem will be either be a routing issue, or a issue related to buffering in your code.
Logged

Lucasnonime

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
Re: Multiplayer dont work without local :/
« Reply #10 on: November 01, 2016, 09:27:28 »

I already dix that, i know my IP adress. But that dont work
Logged

Kai

  • Guest
Re: Multiplayer dont work without local :/
« Reply #11 on: November 01, 2016, 12:23:48 »

With your ServerSocket, did you bind to localhost?
If yes, then you have to bind to the wildcard address (IPv4 "0.0.0.0", IPv6 "[::]") or the address of your network adapter connected to the router/internet.
Otherwise, no connection will reach your process when it only listens on connections established from processes within the same host.
Logged

Lucasnonime

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
Re: Multiplayer dont work without local :/
« Reply #12 on: November 02, 2016, 20:01:06 »

UUh more slower pls xD.
How i am suposed to bind ?
Logged