Skip to content

A light weight project to read the motd of a minecraft sever

Notifications You must be signed in to change notification settings

Nicolas62x/MCServerPinger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCServerPinger

A light weight project to read the motd of a minecraft sever

Example Usage

using System.Net;
using MinecraftPinger;

bool ready = true;

DateTime t0 = DateTime.Now;

Pinger p = new Pinger(
    (string motd, Pinger pinger) =>
    {
        Console.WriteLine($"Received from {pinger.ep} ({(int)(DateTime.Now - t0).TotalMilliseconds}ms):\n{motd}");
        ready = true;
    },
    (bool didconnect, Pinger pinger) =>
    {
        Console.WriteLine($"Failled ping of {pinger.ep}");
        ready = true;
    });
IPEndPoint ep = new IPEndPoint(Dns.GetHostEntry("mcsharp.fr").AddressList[0], 25565);

while (true)
{

    if (ready)
    {
        t0 = DateTime.Now;
        ready = false;
        p.StartChecking(ep);
    }

    Thread.Sleep(1000);
}

About

A light weight project to read the motd of a minecraft sever

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages