Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 00:14

  • Please register to post and access all features, it's quick, easy and FREE!

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.

Reply
 
Old   #1
 
S/W's Avatar
 
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?
S/W is offline  
Old 04/26/2011, 20:41   #2
 
|NeoX's Avatar
 
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.InterNetworkSocketType.StreamProtocolType.Tcp);
    
sock.Connect(IPPORT);
    if (
sock.Connected == true)
        
//ONLINE
    
else
       
//OFFLINE
    
sock.Close(); 
|NeoX is offline  
Thanks
1 User
Old 04/26/2011, 20:52   #3
 
S/W's Avatar
 
elite*gold: 0
Join Date: Nov 2010
Posts: 159
Received Thanks: 39
Quote:
Originally Posted by |NeoX View Post
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.InterNetworkSocketType.StreamProtocolType.Tcp);
    
sock.Connect(IPPORT);
    if (
sock.Connected == true)
        
//ONLINE
    
else
       
//OFFLINE
    
sock.Close(); 
My Teacher
S/W is offline  
Old 04/26/2011, 22:08   #4
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
Quote:
Originally Posted by S/W View Post
My Teacher
-impulse- is offline  
Old 04/26/2011, 22:28   #5
 
_Emme_'s Avatar
 
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; }
        }
_Emme_ is offline  
Thanks
2 Users
Old 04/26/2011, 23:21   #6
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
Quote:
Originally Posted by EmmeTheCoder View Post
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.
InfamousNoone is offline  
Thanks
1 User
Old 04/27/2011, 00:08   #7
 
|NeoX's Avatar
 
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.
|NeoX is offline  
Reply


Similar Threads 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.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.