|
You last visited: Today at 00:14
Advertisement
C# script to check server status online/offline
Discussion on C# script to check server status online/offline within the CO2 Private Server forum part of the Conquer Online 2 category.
04/26/2011, 20:30
|
#1
|
elite*gold: 0
Join Date: Nov 2010
Posts: 159
Received Thanks: 39
|
C# script to check server status online/offline
I am coding my own auto patch and and i wanna display server status in win form any one haw simple code how cheek server status like Online Offline?
|
|
|
04/26/2011, 20:41
|
#2
|
elite*gold: 0
Join Date: Nov 2010
Posts: 237
Received Thanks: 99
|
are you serious? How do you plan to write a patcher if you cant connect to a specific port and say if it responds or not?
Good luck, you will need it.
PHP Code:
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
sock.Connect(IP, PORT);
if (sock.Connected == true)
//ONLINE
else
//OFFLINE
sock.Close();
|
|
|
04/26/2011, 20:52
|
#3
|
elite*gold: 0
Join Date: Nov 2010
Posts: 159
Received Thanks: 39
|
Quote:
Originally Posted by |NeoX
are you serious? How do you plan to write a patcher if you cant connect to a specific port and say if it responds or not?
Good luck, you will need it.
PHP Code:
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
sock.Connect(IP, PORT);
if (sock.Connected == true)
//ONLINE
else
//OFFLINE
sock.Close();
|
My Teacher
|
|
|
04/26/2011, 22:08
|
#4
|
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
|
Quote:
Originally Posted by S/W
My Teacher 
|
|
|
|
04/26/2011, 22:28
|
#5
|
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
|
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; }
}
|
|
|
04/26/2011, 23:21
|
#6
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
|
Quote:
Originally Posted by EmmeTheCoder
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.
|
|
|
04/27/2011, 00:08
|
#7
|
elite*gold: 0
Join Date: Nov 2010
Posts: 237
Received Thanks: 99
|
I already gave an example how to do it. Imo, this thread should be closed.
|
|
|
 |
Similar Threads
|
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
|
status of script to play online?
05/01/2009 - EO PServer Hosting - 22 Replies
anyone have?
tank you
|
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
|
All times are GMT +1. The time now is 00:15.
|
|