Username:    Password:        Click Here To Signup     Forgotten Password
Main Menu
Online
Members: 0

Guests: 37

151.80.x.x dilbertplus
151.80.x.x forum
178.255.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x comment
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x dilbertplus
46.229.x.x forum
54.234.x.x forum
54.36.x.x user
54.36.x.x forum
54.36.x.x dilbertplus
54.36.x.x lgsl
54.36.x.x forum
54.36.x.x dilbertplus
54.36.x.x forum
54.36.x.x forum
54.36.x.x dilbertplus
54.36.x.x forum
54.36.x.x top
54.36.x.x dilbertplus
54.36.x.x forum
54.36.x.x lgsl
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
66.249.x.x forum
66.70.x.x forum
78.46.x.x forum
91.242.x.x forum

Last Seen

Wussie Mon 01:59
Dodgeitorelse Mon 16:49
85filip58 Wed 12:06
Bommel Mon 18:20
Apophis01 Wed 12:35

Newest Members

Forums
php_network_getaddresses: getaddrinfo failed
Wussie
Tue Apr 17 2012, 10:55AM

Posts: 437
Joined: Sun Mar 22 2009, 06:53AM
Registered Member #4938
Hi folks.
I got this problem today trying to get info from a gameserver that went offline. This server's IP address was added to the database in the form of "game.domain.com" instead of a numeric IP, and it was all fine as long as the server was online.
But today I guess the gameserver went down together with its (DNS) nameserver, because when I tried to view the server in it's corresponding LGSL page, I had to wait like 10 seconds for the page to be displayed and then this error appeared:
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /....../lgsl/lgsl_files/lgsl_protocol.php on line 650 Warning: fsockopen() [function.fsockopen]: unable to connect to udp://game.domain.com:27960 (Unknown error) in /....../lgsl/lgsl_files/lgsl_protocol.php on line 650

So in other words, whenever fsockopen is unable to resolve the address "game.domain.com" in a reasonable amount of time, it throws that ugly warning.
Does anybody know how to avoid that warning, messing up my webpage? I would prefer the script rather time out gracefully and just display the "offline" status for that server. BTW, I use LGSL 5.8 standalone.

Not working for you?
Don't forget to share the IP/ports of the offending server so that people can do tests and help you.
Oh, and if you're using a modified lgsl_protocol.php, make sure you disable the feed or it may NOT work!
Website
MadMakz
Tue Apr 17 2012, 08:46PM

Posts: 163
Joined: Wed Sep 24 2008, 07:46AM
Registered Member #4406
that looks like your web host has a general DNS resolver problem to be looked at (doesn't have to be localy tho).

you can turn warnings off via PHP's display_errors directive in php.ini or use the error_reporting directive from within the script to not haave it globaly turned off on the vhost.

to turn everything off add error_reporting(0); in index.php of the standalone LGSL version. right below the <?php tag. "0" will supress everything. notices, warnings, errors, and depricated infos.

if the page still loads slowly you can lower the timeout settings in LGSL config and disable "retry offline servers". if this doesn't help
another try might be to set PHPs default_socket_timeout to something lower. can't recall for sure if this will help and apply on resolve issues.

SpiffyTek
Website
Wussie
Thu Apr 19 2012, 05:26PM

Posts: 437
Joined: Sun Mar 22 2009, 06:53AM
Registered Member #4938
Thanks for the answer MadMakz.
My DNS resolver works just fine, it's the game.domain.com's nameserver that fails regularly. I checked this domain using a free DNS online check website and it turned out both namesevers responsible for domain.com were down during daytime, only to be working after work hours...
Anyway, the idea was that visitors of my webpage should never see php warnings being displayed, even if one fully-qualified-domain-name of a gameserver gets misspelled or cannot be resolved. Warnings would normally not be displayed at all due to the @ character infront of fsockopen() in lgsl_protocol.php, but in my case the @ had no effect, and the error_reporting(0); suggested by you made no difference: warnings were still being displayed!
Your suggestion got me thinking why that happened, and after some digging around I found out that one of the scripts on my webpage (a CMS) implemented a custom error handling function which had no respect for the @ operand. So I googled this new issue and found a cure:
I had to insert one line at the top of the error_handler() function definition:
if (error_reporting() == 0) { return; }

And that fixed it no more warnings for functions preceded by @ ! hope this helps someone...


Not working for you?
Don't forget to share the IP/ports of the offending server so that people can do tests and help you.
Oh, and if you're using a modified lgsl_protocol.php, make sure you disable the feed or it may NOT work!
Website
 

Jump:     Back to top


You are not logged in - Click Here To Signup

Username:    Password:   

Mini Buttons

.... © GreyCube.com - Richard Perry - Powered by e107.org