I am sorry for asking too many questions but i want to know how many player online on my server :)
<?php echo (exec('netstat -a -n |find "5816" |find "ESTABLISHED" /c')-2); ?>
for the same server and my website is php :handsdown:Quote:
Moronic affluence is ruining this community. Every time I ask you for specification, you give me jack all. Again, specify. What type of website is it? PHP, just HTML? What type of server is this for? The same TQ Binary server you were asking about previously? Speak in more than one sentence at a time, damn it.
I'm not sure why you are being sarcastic! If you don't understand the point of "-2" use your brain for like 5 secs you will figure it out , but let me give you a hint , when your server "listen on" that port for up coming connections , doesn't that considered as a connection? oh well yeah it does, so next time Google, before you act sarcastic maybe?!Quote:
Why is there a minus two in that php function?
"How many connections are established to my server netstat?"
Zero.
"Let's subtract two from that."
You don't even know what your sodding command does. No, it doesn't return two for the account and game servers unless someone's connected because you're finding based on the "ESTABLISHED" string. A listening server doesn't have an additional "ESTABLISHED" status until someone connects to it; it has the "LISTENING" status only. God, no wonder a few trash servers had -2 as the player counts. It was because they were using your broken script.Quote:
I'm not sure why you are being sarcastic! If you don't understand the point of "-2" use your brain for like 5 secs you will figure it out , but let me give you a hint , when your server "listen on" that port for up coming connections , doesn't that considered as a connection? oh well yeah it does, so next time Google, before you act sarcastic maybe?!
PS: figure the second connection yourself, I already explained one :)
I was clear about it works when you listen on the ports, and yes I agree it was an old script , it's not efficient , but it gives him a starting point?! ,I'm not going to spoonfeed him! my point of argument with you is that you were being sarcastic instead of discussing what is the wrong with the script to help him!Quote:
You don't even know what your sodding command does. No, it doesn't return two for the account and game servers unless someone's connected because you're finding based on the "ESTABLISHED" string. A listening server doesn't have an additional "ESTABLISHED" status until someone connects to it; it has the "LISTENING" status only. God, no wonder a few trash servers had -2 as the player counts. It was because they were using your broken script.
Edit: What you should be doing is finding against the local endpoint. That way, you wouldn't be trying to do something stupid like subtracting 2 from the connection count - it would just be the number of remote connections.
It handles the lower bounding edge case for no connections incorrectly. It is, therefore, incorrect. If you actually read what I wrote, I wouldn't have to repeat this. Edit: Regardless, this isn't my problem to fix and I have class and work in the morning. Cheers.Quote:
I was clear about it works when you listen on the ports, and yes I agree it was an old script , it's not efficient , but it gives him a starting point?! ,I'm not going to spoonfeed him! my point of argument with you is that you were being sarcastic instead of discussing what is the wrong with the script to help him!