Hello Fernando
 
Well I haven't used C#, but I have been able to code a quick HL Server Status written in PHP, C++ and VB.
My example PHP Script can be found at: http://users.initcorp.co.uk/paulk/HL2SInfo/hl2sinfo.php
 
Note: This script is only beta and was only written to get use to the new Packet structure for HL2 when CS:Source was first in beta, and hasn't had much done to it for a while :(
 
To see that source just add a 's' at the end of the pages.
e.g..
 
As to my C++ and VB examples, those may take some time digging them up :P
 
btw, What made you choose to write it in C# ?
 
 
Paul Kirby


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fernando García
Sent: Thu 02 December 2004 10:59
To: [EMAIL PROTECTED]
Subject: [hlds_apps] Question about UDP communication and C#

    Hi all!

    My first mail. I hope you can unstuck me in my project and understand my incredible english learned in Spain.

    Im coding a little app (C#) just for our clan members to ping our hlds server and check if its running.

    Well, I have a php script in a web page to show actual server status. Looking the code I found what command is used and how is sended to server, via UDP packet.

    Im trying to do the same stuff in C#, but no way. A piece of code:

    string cmdHL = "˙˙˙˙status\x00";   // same as php (works well there...)

    int puertoHL = 27015;

    IPAddress ip = IPAddress.Parse("xx.xx.xx.xx");

    UdpClient udppak = new UdpClient("xx.xx.xx.xx",puertoHL);

    byte[] cmd = Encoding.ASCII.GetBytes(cmdHL);

    int sended =
udppak.Send(cmd,cmd.Length);

    IPEndPoint conex = new IPEndPoint(ip,puertoHL);

    byte[] received =
udppak.Receive(ref conex);

   
    Thats all. App gets blocked in Receive instruction waiting for some packet that never arrives (I guess...).

    Any ideas? wrong command encoding?

    Thx in advance!




_______________________________________________ hlds_apps mailing list [EMAIL PROTECTED] http://list.valvesoftware.com/mailman/listinfo/hlds_apps

Reply via email to