PHP Socket Open issues

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

NegativeKelvin

Thread Starter
Joined
Apr 11, 2012
Messages
298
Well, I'm setting up a Minecraft Server list. I'm having issues with an error message that shows up when it can't pull data from the server. I uploaded the source code to:
Source Code: http://negacraft.twilightparadox.com/owncloud/public.php?service=files&t=g9fbsmypct4i8nqb412nl2wlx7ka0af6
Glitchy Page: http://negacraft.twilightparadox.com/mcstatus/
Is there a problem with the code? What can I do to fix the issue where it says:

Warning: stream_socket_client(): unable to connect to tcp://mc.example.com:25565 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\xampp\htdocs\MCStatus\Minecraft\stats.php on line 10

Warning: Creating default object from empty value in C:\xampp\htdocs\MCStatus\Minecraft\stats.php on line 13
 

JiminSA

Jim
Joined
Dec 15, 2011
Messages
3,400
Could you possible post the php script - stats.php - and we can get a better looksee...
 
Joined
Apr 23, 2004
Messages
2,960
The error says the host failed to respond. I'm betting it is responding, but your firewall may not be allowing the connection to come in. Check your firewall settings to allow port 25565 inbound.
 

JiminSA

Jim
Joined
Dec 15, 2011
Messages
3,400
No, that server isn't running. I just don't want it to display the error
Is this server necessary? If it never runs, then obviously it is not. But even if it does on occasion, do you need it? I would be tempted to leave the call to this particular stats function out. But that's your call BC:) - You are getting the error message because the server isn't running, therefore don't call the function which tries to connect to it...
 

JiminSA

Jim
Joined
Dec 15, 2011
Messages
3,400
How much dumber can I get:mad: Obviously you want to access this site!
What you may consider is a check to see if it is running before you try and get the stats. I would suggest you look at stream select to determine it's status and call your stats function accordingly (i.e. if it's sending stuff, check stats and dont if it isn't)
 

NegativeKelvin

Thread Starter
Joined
Apr 11, 2012
Messages
298
It's a Minecraft server, it's down due to maintanance, But rather than it showing the error, I want it to just show a red "X" by the status, without the error.
 

JiminSA

Jim
Joined
Dec 15, 2011
Messages
3,400
You could best do that in the program that calls the stat.php (mcstats.php??), by doing a quick check on the site status (stream_select) and setting the red cross image if it's unavailable - if you could post the source for the calling program, I'm sure we can sort something out...:)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top