The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDLNet(not getting packs with WAN IP but works fine with LAN
Timodor


Joined: 14 Apr 2013
Posts: 72
Location: Australia
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?
SDLNet(not getting packs with WAN IP but works fine with LAN
MrOzBarry


Joined: 26 Jun 2010
Posts: 620
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

Re: SDLNet(not getting packs with WAN IP but works fine with
Timodor


Joined: 14 Apr 2013
Posts: 72
Location: Australia
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

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


Joined: 26 Jun 2010
Posts: 620
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:
Quote:
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

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

Hello
Timodor


Joined: 14 Apr 2013
Posts: 72
Location: Australia
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
SDLNet(not getting packs with WAN IP but works fine with LAN
MrOzBarry


Joined: 26 Jun 2010
Posts: 620
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 Smile

On Sat, Aug 20, 2016 at 10:52 AM, Timodor wrote:
Quote:
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

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

MrTAToad


Joined: 13 Feb 2014
Posts: 205
Location: Chichester, England
Dont forget on a Linux device port numbers below a certain range can only be used with root access...
Re: SDLNet(not getting packs with WAN IP but works fine with
Timodor


Joined: 14 Apr 2013
Posts: 72
Location: Australia
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 Smile

On Sat, Aug 20, 2016 at 10:52 AM, Timodor wrote:
Quote:
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

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