mikeee324 Posted December 18, 2011 Share Posted December 18, 2011 I'm running a MTA server and a web server on a ubuntu vps. I've been trying to ping the mta sa server using fsockopen and all I keep getting from it is connection refused. How do I see if the server is running? Link to comment
mikeee324 Posted December 18, 2011 Author Share Posted December 18, 2011 Sorted, needed to do it over UDP instead of TCP. Link to comment
Jaysds1 Posted December 18, 2011 Share Posted December 18, 2011 Can you explain to me how you did it pls? Link to comment
mikeee324 Posted December 18, 2011 Author Share Posted December 18, 2011 I used the example from the php site, but now it just seems to be saying my servers online when it isn't I mean i can even use any port and it'll say it's online. Anyone know how i can do this accurately? $fp = fsockopen("udp://127.0.0.1", 22003, $errno, $errstr); if (!$fp) { echo "Offline"; } else { echo "Online"; fclose($fp); echo "</td>"; } I read somewhere too that the system might not know that theres nothing there until data is written/read to/from the port, i tried using fread but it didn't bring anything back at all. Link to comment
FatalTerror Posted December 21, 2011 Share Posted December 21, 2011 Try to use TCP. <?php $fp = fsockopen("tcp://IP:PORT", PORT, $errno, $errstr); if(isset($fp)){ echo "Server is online !"; } else{ echo "Server is offline !"; } ?> I don't test, but i think it will work Link to comment
Jaysds1 Posted December 22, 2011 Share Posted December 22, 2011 wait, is your ip really 127.0.0.1 ? and try both udp and tcp Link to comment
myonlake Posted December 22, 2011 Share Posted December 22, 2011 wait, is your ip really 127.0.0.1 ?and try both udp and tcp 127.0.0.1 is localhost. Link to comment
DarkLink Posted December 22, 2011 Share Posted December 22, 2011 I think you need to use the public ip, test it Link to comment
mikeee324 Posted December 22, 2011 Author Share Posted December 22, 2011 Both the web server and MTA server are on the same machine so that's why i'm using localhost. Tried both tcp and udp on the main port and the web port of the mta server, it's not having any of it. Link to comment
Jaysds1 Posted December 22, 2011 Share Posted December 22, 2011 127.0.0.1 doesn't necessarily means localhost, put in your ip address that you put in the mtaserver.conf file . Link to comment
AGENT_STEELMEAT Posted December 22, 2011 Share Posted December 22, 2011 127.0.0.1 doesn't necessarily means localhost 127.0.0.1 is always localhost. Welcome to basic computer science. Link to comment
Jaysds1 Posted December 22, 2011 Share Posted December 22, 2011 oh, wow, ok, but he should try putting the ip address that's in the mtaserver.conf file Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now