Jump to content

Need some help with socket script


Joe_Dean

Recommended Posts

Hi,

 

I have this socket script implemented into my SMF forums that connects to a gaming server and outputs info about the server (current players, max allowed players, etc).

 

The gaming server does go offline quite a bit, and when this happens, my forums don't load. So the forums only load if the server is online, and I don't want the forums depending on the server to operate, yet I really want this script on my forums to show information about the gaming server. I'm not a PHP programmer, this is someone else's script, and I've even tried contacting them for support but they posted this script like a year ago and there is no way of contacting for support.

 

Here's the script: http://pastebin.com/f71cf4473

 

Can someone make the script halt itself if it cannot connect to the gaming server within so many seconds?

Link to comment
https://forums.phpfreaks.com/topic/124832-need-some-help-with-socket-script/
Share on other sites

If the server is down it should error out here. Can you take your server down for testing? You might want to try turning on your PHP error messages at the server and then take down your gaming server to get better information on why your script dies.

 

echo "Socket Error: $errno - $errstr";

But determining where your script fails and stops the forum from loading is necessary to fix the code. Most web hosts turn off PHP error reporting so they don't blast sensitive information to the random web folks. When error reporting is turned off and PHP fails during the script, you get ZERO information from the web server. No HTML, no JAVASCRIPT, just nothing. if you turn on error reporting and close your gaming server down you'll get error messages on the website that will allow for an easier correction of your problem.

It depends on the server setup, you could contact your host they may need to enable it, or you can turn on error reporting using your forums, or you can place a .htaccess file in the correct directory. Once you have error reporting turned on you should be able to get an error message that I can help you with even further.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.