473,412 Members | 2,142 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Querying a HL Server

I'm trying to query a HL Server and return the "status" of it. I'm
unsure of how to do this exactly so I need some help, what I have so
far is as follows...
1. <?php
2. // Host / Port Settings:
3. $host = '70.86.248.86';
4. $socket = fsockopen('udp://' . $host, 27015, $errno, $errstr);
5. if ($socket) {
6. echo 'working';
7. if (fwrite($socket, 'status')) {
8. echo fread($socket, 128);
9. } else {
10. echo 'Problems writing';
11. }
12. } else {
13. echo 'not working';
14. }
15. ?>
Does anybody know how to do this properly or succeeded in doing this
before?
I am trying to query a counter-strike server and return the current
players/max players.

Aug 8 '06 #1
2 2331
bryan wrote:
I'm trying to query a HL Server and return the "status" of it. I'm
unsure of how to do this exactly so I need some help, what I have so
far is as follows...
1. <?php
2. // Host / Port Settings:
3. $host = '70.86.248.86';
4. $socket = fsockopen('udp://' . $host, 27015, $errno, $errstr);
5. if ($socket) {
6. echo 'working';
7. if (fwrite($socket, 'status')) {
8. echo fread($socket, 128);
9. } else {
10. echo 'Problems writing';
11. }
12. } else {
13. echo 'not working';
14. }
15. ?>
Does anybody know how to do this properly or succeeded in doing this
before?
I am trying to query a counter-strike server and return the current
players/max players.
Did you try asking the people running the server? They should know what
protocol you need to use.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 8 '06 #2
On 7 Aug 2006 17:49:08 -0700, bryan wrote:
>I'm trying to query a HL Server and return the "status" of it. I'm
unsure of how to do this exactly so I need some help, what I have so
far is as follows...
1. <?php
2. // Host / Port Settings:
3. $host = '70.86.248.86';
4. $socket = fsockopen('udp://' . $host, 27015, $errno, $errstr);
5. if ($socket) {
6. echo 'working';
7. if (fwrite($socket, 'status')) {
8. echo fread($socket, 128);
9. } else {
10. echo 'Problems writing';
11. }
12. } else {
13. echo 'not working';
14. }
15. ?>
Does anybody know how to do this properly or succeeded in doing this
before?
I am trying to query a counter-strike server and return the current
players/max players.
My short answer is *don't bother*!

I tried for weeks to get sockets to behave for a similar application
(but for an online flight sim). It seems each incarnation of PHP
screws the sockets code around differently. After a fair while, I
found that some bugs reported in PHP3 are still there.

I also found differences in behaviour between Win32 and Unix/Linux
implementations of sockets. Don't be misled by the online function
references that make it look easy - I found that a fair few of the
routines just did not work consistently.

Also ... check you're getting past your firewall! I used a network
packet sniffer to see traffic actually leaving one machine then seeing
what (if anything) appeared on the other.

Adam.
Aug 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Keith | last post by:
I am fairly new to SQL so sorry if this is a really dumb question. I have a small (still) SQL database, which I am trying to query from an ASP page. The field I am querying is of DATETIME data...
1
by: radicool | last post by:
What is the User ID and Password for querying Follett's TextLink database. I am using Adaptive Server Anywhere. If this is not the best group to ask this, where would be?
6
by: Greg | last post by:
I am working on a project that will have about 500,000 records in an XML document. This document will need to be queried with XPath, and records will need to be updated. I was thinking about...
0
by: Chris | last post by:
Hi all, I have a web site which allows our customers to write data via forms into an access table stored on our ISP's remote server. My question is how do I efficiently retrieve the data? ISP...
5
by: Shane | last post by:
I wonder if someone has any ideas about the following. I am currently producing some reports for a manufacturing company who work with metal. A finished part can contain multiple sub-parts to...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
4
by: paulb | last post by:
I was wondering if it is possible to continuously query a real-time datastream using SQL Server. Does anyone have any experience of this? I have found LINUX based systems such as Borealis and...
5
by: sql_er | last post by:
Guys, I have an XML file which is 233MB in size. It was created by loading 6 tables from an sql server database into a dataset object and then writing out the contents from this dataset into an...
3
by: RJN | last post by:
Hi I've written a code that queries Windows LDAP server and works fine, but the same doesn't work when querying Solaris LDAP server. DirectoryEntry de = new...
2
by: RajSharma | last post by:
Hi, I am facing a problem regarding querying thru a large table having millions of rows....... Its hanging in between while querying for all those rows Can anybody suggest me a query regarding :...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.