To check if it's on (or actually, if it's in the state to accept connections), you basically try to connect to it and read from it's result. You could use the Socket class (as provided above) or a TcpClient.
Code:
static string IP = "79.143.177.32";
static int Port = 9959;
static void Main(string[] args)
{
Console.WriteLine("Server on port {0} is {1}",Port, Online() ? "online" : "offline");
}
static bool Online()
{
TcpClient client = new TcpClient();
try { new TcpClient().Connect(IP,Port); return true; }
catch { return false; }
}
To check if it's on (or actually, if it's in the state to accept connections), you basically try to connect to it and read from it's result. You could use the Socket class (as provided above) or a TcpClient.
Code:
static string IP = "79.143.177.32";
static int Port = 9959;
static void Main(string[] args)
{
Console.WriteLine("Server on port {0} is {1}",Port, Online() ? "online" : "offline");
}
static bool Online()
{
TcpClient client = new TcpClient();
try { new TcpClient().Connect(IP,Port); return true; }
catch { return false; }
}
Should probably disconnect the socket before returning.
Online/Offline Script für die Hompage?! 11/22/2010 - Metin2 Private Server - 13 Replies Liebe Community von Elite
Ist es möglich das man auf einer Seite, ein script hat wo zu sehen ist, wer IG der Teamler online ist, und Im forum online ist.
Ich habe leider nichts per Sufu gefunden.
Habe dies aber schonmal auf einem pserver gesehen! Kann natürlich auch sein das die da die bilder On off nur geändert haben immer xD
Jede Antwort => Thx.
Mfg
[SAMMELTHREAD]ONLINE/OFFLINE[STATUS] 07/30/2010 - Metin2 Private Server - 8 Replies Also da es ja eigentlich verboten ist nach dem Serverstatus zu fragen habe ich mir gedacht mache ich einen Sammelthread in dem ob ein Server on oder Off ist!
Ich habe dazu auch nichts gefunden im Metin2-Bereich!
Serverstatus
Hier noch eine 2. Seite
Serverstatus2 (Noch verbuggt)
[HOW TO] Port Check für Online Status 06/20/2010 - Metin2 PServer Guides & Strategies - 24 Replies Hey....
Da mich viele gefragt haben wie ein Online Status funktioniert, also das es auf der HP immer geändert wird, werde ich es hier mal erklären.....
Da ich per SuFu nichts gefunden habe like this habe ich es mal gemacht -->
1. Ihr geht auf --> blackout-gaming
2. Für MySQL tragt ihr dort alles ein --> IP bzw DynDNS und als Port --> 3306
Check the online status of ENEMY players 03/16/2008 - WoW Exploits, Hacks, Tools & Macros - 2 Replies Did you know that you can check wether a player of the opposing faction is online/offline?
All you have to do it type /invite
If the enemy player is offline, you will get a message saying "Could not find bla bla bla"
But the interesting part is that if he is online, you will get a message saying "Target is unfriendly".
Could be useful for checking wether that annoying elemental plateu ganker is online or not