C # ping minecraft

Encontré este pequeño fragmento de código que le permitiría hacer ping a un servidor de Minecraft en PHP, pero ahora quiero hacer esto en C #.

Intenté hacer esto por mi cuenta pero por alguna razón simplemente no funciona

        UdpClient client = new UdpClient();
        IPEndPoint ep;
        try
        {
            ep = new IPEndPoint(IPAddress.Parse("-snip-"), -snip-);
            client.Connect(ep);
        }
        catch { Console.WriteLine("Error"); Console.ReadLine(); return; }
        byte[] bytes = new byte[1];
        bytes[0] = (byte)0xFE;
        client.Send(bytes, bytes.Length);
        IPEndPoint rep = new IPEndPoint(IPAddress.Any, 0);
        byte[] recv = client.Receive(ref rep);
        Console.WriteLine(ASCIIEncoding.ASCII.GetString(recv));
        Console.ReadLine();

El servidor parece ignorar completamente el paquete. Este es el fragmento de código que encontré:

    $fp = fsockopen($host, $port, $errno, $errstr, $timeout);
    if (!$fp) return false;

    //Send 0xFE: Server list ping

    fwrite($fp, "\xFE");

    //Read as much data as we can (max packet size: 241 bytes)
    $d = fread($fp, 256);

    //Check we've got a 0xFF Disconnect
    if ($d[0] != "\xFF") return false;

¿Alguien podría indicar qué error estoy cometiendo? ¡Gracias!