Jump to content
Sign in to follow this  
mindstorm

Quering arma 3 server for information

Recommended Posts

Hey guys,

I've been trying to find out how to query an arma3 server (in this case from C#). No luck so far however.

From my understanding since gamespy stopped arma switched over to steamquery?

So far I've tried this libarary (C#):

https://github.com/firefly2442/phparma2serverstatus

This didn't work however. Than I read something about gamespy stopping so I looked into steam condenser, and found a library.

https://github.com/txdv/steam-condenser-csharp

This however also doesn't work.

Is there anywhere I can find some sort of clarification on what protocol arma uses a.t.m. and how to implement it?

Share this post


Link to post
Share on other sites

You should use the querry on the query port that is hardcoded to gameport+1 (If I remember correctly).

The full description of the protocol used for steam querry can be found here. There is additionnal information on the Wiki .

There migth be some implemented API libraries around.

Share this post


Link to post
Share on other sites

Thanks for the reply.

I found this class:

https://github.com/Noahii/ArmAQuery/blob/master/ArmA3.cs

It's depricated (as in not working). But with the steam server queries page I've been able to fix it.

edit:

I've been able to get the server information working but not the ping. This is my code for server information:

                   byte[] request, response;

                   IPEndPoint remoteIpEndpoint = new IPEndPoint(IPAddress.Parse(host), port);
                   client.Client.ReceiveTimeout = 100;
                   client.Connect(remoteIpEndpoint);

                   //Server Info
                   request = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0x54, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x45, 0x6E, 0x67, 0x69, 0x6E, 0x65, 0x20, 0x51, 0x75, 0x65, 0x72, 0x79, 0x00 };
                   client.Send(request, request.Length);
                   response = client.Receive(ref remoteIpEndpoint);

                   //string dataServer = Encoding.ASCII.GetString(response).Remove(0, 5);
                   this.ServerInfo = ServerInfo.Parse(response);

This works. However the ping part doesn't work:

                    request = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0x69 };
                   client.Send(request, request.Length);
                   response = client.Receive(ref remoteIpEndpoint);

I get a socketexeption. The request header is however excactly as stated on the steam server queries page.

Anny suggestions on how to get the ping time?

Edit2

Feeling so stupid right now. Just implemented it myselve:

 Stopwatch.Start();
                   response = client.Receive(ref remoteIpEndpoint);
                   Stopwatch.Stop();
                   this.ping = Stopwatch.ElapsedMilliseconds;

Edited by mindstorm

Share this post


Link to post
Share on other sites

-would be very nice if you publicise a working query that we can plug into our sites

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×