SDLNet(not getting packs with WAN IP but works fine with LAN

Hello,

I can’t seem to access my SDL Server via WAN IP address from the Client. But using a LAN address works perfectly fine.
SDL server doesn’t receive packets? What might be occurring?

You might need to open/forward the port on your router.On Aug 20, 2016 12:46 AM, “Timodor” wrote:

Hello,

I can’t seem to access my SDL Server via WAN IP address from the Client.
But using a LAN address works perfectly fine.
SDL server doesn’t receive packets? What might be occurring?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I ended up creating an SDL Net Server on Windows thinking it was Android Limitation. I opened the port on the Windows FireWall and Port Forward the Modem, still no luck.

I have no idea.

IPaddress client::ResolveHost(char* address, int port)
{
IPaddress serverAddress;
/* Resolve server name */
//if (SDLNet_ResolveHost(&serverAddress, address, port)) //WAS 127.0.0.1
if (SDLNet_ResolveHost(&serverAddress, “WAN ADDRESS”, 2000)) //WAS 127.0.0.1
{
//fprintf(stderr, “SDLNet_ResolveHost(%s %d): %s\n”, argv[1], atoi(argv[2]), SDLNet_GetError());
//exit(EXIT_FAILURE);
}
return serverAddress;
}

This How the Client is setting to Connect, but if the WAN ADDRESS is replaced with LAN Address it works

This is Server Address

IPaddress serverAddress;
/* Resolve server name */
//if (SDLNet_ResolveHost(&serverAddress, address, port)) //WAS 127.0.0.1
if (SDLNet_ResolveHost(&serverAddress, NULL, port)) //WAS 127.0.0.1
{
//fprintf(stderr, “SDLNet_ResolveHost(%s %d): %s\n”, argv[1], atoi(argv[2]), SDLNet_GetError());
//exit(EXIT_FAILURE);
}
return serverAddress;

MrOzBarry wrote:> You might need to open/forward the port on your router.

On Aug 20, 2016 12:46 AM, “Timodor” <@Timodor (@Timodor)> wrote:

  Hello,

I can’t seem to access my SDL Server via WAN IP address from the Client. But using a LAN address works perfectly fine.
SDL server doesn’t receive packets? What might be occurring?


SDL mailing list
SDL at lists.libsdl.org (SDL at lists.libsdl.org)
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

You might want to try a port scan or something like
http://www.canyouseeme.org/ (I don’t know how legit that site is, so use
that at your own risk, I guess.) to ensure your port is open to the
internet.

I guess if that’s not the issue, the next step has to include sharing your
your server/client code, since the code you provided is just outputting
your ip address.On Sat, Aug 20, 2016 at 6:27 AM, Timodor wrote:

I ended up creating an SDL Net Server on Windows thinking it was Android
Limitation. I opened the port on the Windows FireWall and Port Forward the
Modem, still no luck.

I have no idea.

IPaddress client::ResolveHost(char* address, int port)
{
IPaddress serverAddress;
/* Resolve server name */
//if (SDLNet_ResolveHost(&serverAddress, address, port)) //WAS 127.0.0.1
if (SDLNet_ResolveHost(&serverAddress, “WAN ADDRESS”, 2000)) //WAS
127.0.0.1
{
//fprintf(stderr, “SDLNet_ResolveHost(%s %d): %s\n”, argv[1],
atoi(argv[2]), SDLNet_GetError());
//exit(EXIT_FAILURE);
}
return serverAddress;
}

This How the Client is setting to Connect, but if the WAN ADDRESS is
replaced with LAN Address it works

This is Server Address

IPaddress serverAddress;
/* Resolve server name */
//if (SDLNet_ResolveHost(&serverAddress, address, port)) //WAS 127.0.0.1
if (SDLNet_ResolveHost(&serverAddress, NULL, port)) //WAS 127.0.0.1
{
//fprintf(stderr, “SDLNet_ResolveHost(%s %d): %s\n”, argv[1],
atoi(argv[2]), SDLNet_GetError());
//exit(EXIT_FAILURE);
}
return serverAddress;

MrOzBarry wrote:

You might need to open/forward the port on your router.
On Aug 20, 2016 12:46 AM, “Timodor” <> wrote:

Quote:

Hello,

I can’t seem to access my SDL Server via WAN IP address from the Client.
But using a LAN address works perfectly fine.
SDL server doesn’t receive packets? What might be occurring?


SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I kinda sorted it now, the issue is I can’t use my own network to connect to the WAN IP, but an outside device can. EG I enabled my Data on my Phone and it connected to both my new Windows Dedicated Server and Server on the Android Device. Thats the whole purpose of the server outside access. But I guess connecting to it from the inside might be some type of loopback issue.

Cheers Barry thanks for eagerness to help

Well, if you can use your data on your android device, then your router is
blocking the port, but it sounds like your code is good, so carry on :)On Sat, Aug 20, 2016 at 10:52 AM, Timodor wrote:

I kinda sorted it now, the issue is I can’t use my own network to connect
to the WAN IP, but an outside device can. EG I enabled my Data on my Phone
and it connected to both my new Windows Dedicated Server and Server on the
Android Device. Thats the whole purpose of the server outside access. But I
guess connecting to it from the inside might be some type of loopback
issue.

Cheers Barry thanks for eagerness to help


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Dont forget on a Linux device port numbers below a certain range can only be used with root access…

The Port is fine I think, using 2500, My Phone has connect through my IP ADSL connection, through my router and can access Deciated Server and Android Device. My phone is going through 4G service.

The only issue why can’t I go out and back in using my ADSL connection

MrOzBarry wrote:> Well, if you can use your data on your android device, then your router is blocking the port, but it sounds like your code is good, so carry on :slight_smile:

On Sat, Aug 20, 2016 at 10:52 AM, Timodor <@Timodor (@Timodor)> wrote:

  I kinda sorted it now, the issue is I can't use my own network to connect to the WAN IP, but an outside device can. EG I enabled my Data on my Phone and it connected to both my new Windows Dedicated Server and Server on the Android Device. Thats the whole purpose of the server outside access. But I guess connecting to it from the inside might be some type of loopback issue. 

Cheers Barry thanks for eagerness to help


SDL mailing list
SDL at lists.libsdl.org (SDL at lists.libsdl.org)
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)