Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Check for open Port from Online PHP Server

Author
Message
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 28th Dec 2019 21:28 Edited at: 28th Dec 2019 21:34
I'm in the process of creating a Multiplayer Library in AppGameKit Studio and It already has the basic ability to handle joining and disconnecting via TCP and movement via UDP.
It can display LAN server via Broadcast and public server using a PHP Server and MySQL.
Now to remove a entry from the DB, I want to check if the Game-Server is running, if not it can be removed.

The only real problem is cleaning up the game-server list if the game-server is forced to close.
I prefer to remove entries while someone requests the list or a game-server tries to create an entry into the list.
I don't want to run a cronjob or something.

I thought I could use fsockopen but had no success.
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 29th Dec 2019 02:46
I'm guessing you're checking via TCP, so 'Adress$="tcp://$ipaddress"' or something similar. If so, the method you're using should work. But the server you are attempting to connect to will need to allow an inbound request like that on the specified port, otherwise it'll just deny it and the check will fail.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th Dec 2019 08:17 Edited at: 29th Dec 2019 11:52
Yeah the call im triying looks like:
IsOpen("tcp://123.123.123.123",1025)
Port 1025 is forwarded in the router.
I'll check again but im pretty sure it'll not work

[Edit]Nope, no success and the error output says: Error #111 : Connection refused[/Edit]


[Edit]Aaah ! the free provider doesnt support fsockopen
Not sure what I do now...changing the provider ?...someone knows a free one that supports what I need ?[/Edit]
JasonPC
8
Years of Service
User Offline
Joined: 14th Apr 2015
Location: United Kingdom
Posted: 29th Dec 2019 15:06
If your free hosting provider doesn't support fsockopen, consider using the free Tier off Amazon EC2..
The easist way is to go Lightsail, pick a Linux instance with Wordpress/Lamp/Node/whatever you need.

Select a Free Tier (will be limited to 1 CPU, 512MB/Ram etc, but certainly fine for development.

Create the instance and then assign a static IP Address (you can then decide to bind it to a domain name or just go via IP).
You'll have Root Access to the machine, so can enable/install features if they're not already in place.

I've been using Lightsail with the 3 domain Plesk control panel for a few months. Very stable and much cheaper than my old host.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th Dec 2019 18:38
Looks like Lightsail is only free for one month ?
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 30th Dec 2019 00:09
Some host providers will be willing to open a port on a server for you for such purposes, but you typically have to request it directly via their support channels.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th Dec 2019 20:59
Just wanted to say that it works as intended if you have a server that allows fsockopen.
Thanks nonom

Login to post a reply

Server time is: 2024-03-29 07:57:10
Your offset time is: 2024-03-29 07:57:10