Take a look at my coding support formus at http://www.kquery.com/forums/index.php?showforum=24 , there are quite a few bits of code which can show you how to do this properly. If you can't find one, create a new post and someone will get back to you :)
 
Kris.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fernando Garc�a
Sent: 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