Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 00:54

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

Advertisement



[Release]Server Status in Launcher

Discussion on [Release]Server Status in Launcher within the Rappelz Private Server forum part of the Rappelz category.

Reply
 
Old   #1
 
M>M's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 264
Received Thanks: 240
[Release]Server Status in Launcher

hi all,
i wanted to give you a code for vb 2010 to show it the server is online or offline

first for the imports
Code:
Imports System.Net.Sockets
then under the Public Class Form1 insert this code
Code:
Dim game As New TcpClient()
Dim auth As New TcpClient()
the game dim is for the game server state and auth is for auth server state
then for the code of the status you can but it any were you want in the form load if you want it to see if the the server is off or on when the launcher is started or in a button so the player can manual see it
you will need also two labels to in your form

and this is the link for the FULL launcher just edit the IP and PORT
download form :
Screenshoots
if it's not online
and when it's online
i hope you like it , and if you had any problem please post in this topic or pm .

have a nice day.
M>M is offline  
Thanks
7 Users
Old 01/08/2012, 13:52   #2


 
Xijezu's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 5,084
Received Thanks: 3,458
Even if I still hate Visual Basic:

Nice.

Just as an tip: Try to build it like this (C# code):

Code:
try{
auth.Connect();
if(auth.Connected){
    // Do Something
    auth.Close(); // Close Socket !important!
}
}catch{
    // Do something (offline)
}
So you have that in 1 part.
Xijezu is offline  
Thanks
2 Users
Old 01/08/2012, 14:09   #3
 
M>M's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 264
Received Thanks: 240
Quote:
Originally Posted by Xijezu View Post
Even if I still hate Visual Basic:

Nice.

Just as an tip: Try to build it like this (C# code):

Code:
try{
auth.Connect();
if(auth.Connected){
    // Do Something
    auth.Close(); // Close Socket !important!
}
}catch{
    // Do something (offline)
}
So you have that in 1 part.
like you hate Visual Basic I hate C# and C++
I spent days trying to find a code for the browser and did not succeed that way i hate them they are very hard to learn
but Nice
M>M is offline  
Old 01/09/2012, 00:22   #4
 
SilentBill's Avatar
 
elite*gold: 0
Join Date: Jun 2011
Posts: 305
Received Thanks: 178
Quote:
Originally Posted by Xijezu View Post
Even if I still hate Visual Basic:

Nice.

Just as an tip: Try to build it like this (C# code):

Code:
try{
auth.Connect();
if(auth.Connected){
    // Do Something
    auth.Close(); // Close Socket !important!
}
}catch{
    // Do something (offline)
}
So you have that in 1 part.
Always put the connection.close() in the finally clause (as in try-catch-finally), 'cause otherwise, if there's an exception, it won't get closed. A finally always gets executed, exception or not.

I also dislike VB, feels so amateurish. No offense.
SilentBill is offline  
Old 01/09/2012, 00:24   #5


 
Xijezu's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 5,084
Received Thanks: 3,458
Quote:
Originally Posted by SilentBill View Post
Always put the connection.close() in the finally clause (as in try-catch-finally), 'cause otherwise, if there's an exception, it won't get closed. and a finally always gets executed, exception or not.

I also dislike VB, feels so amateurish... no offense.
Correct me if I'm wrong (cause I usually don't use Sockets & co.), but if the Socket failed while connection, the Socked is already closed, isn't it? oO
Xijezu is offline  
Old 01/09/2012, 00:26   #6
 
SilentBill's Avatar
 
elite*gold: 0
Join Date: Jun 2011
Posts: 305
Received Thanks: 178
Maybe, but the only way to truly be sure is by closing it yourself. And the only way to make sure that gets executed is in the finally clause.
EDIT: It's also good practice to always close your connections. Even if they get closed by themselves (timeout, etc.)
SilentBill is offline  
Thanks
1 User
Old 01/09/2012, 01:31   #7


 
Xijezu's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 5,084
Received Thanks: 3,458
Quote:
Originally Posted by SilentBill View Post
Maybe, but the only way to truly be sure is by closing it yourself. And the only way to make sure that gets executed is in the finally clause.
EDIT: It's also good practice to always close your connections. Even if they get closed by themselves (timeout, etc.)
Nice to know, something lerned again. ;D
Xijezu is offline  
Old 01/10/2012, 06:50   #8
 
SilentBill's Avatar
 
elite*gold: 0
Join Date: Jun 2011
Posts: 305
Received Thanks: 178
I got my *** chewed on my first job for not closing my connections, boss man wondered why the app was hanging after time passed, I learned the hard way :P
SilentBill is offline  
Old 01/28/2012, 09:02   #9
 
elite*gold: 0
Join Date: Aug 2011
Posts: 1
Received Thanks: 0
Post

Quote:
Originally Posted by M>M View Post
hi all,
i wanted to give you a code for vb 2010 to show it the server is online or offline

first for the imports
Code:
Imports System.Net.Sockets
then under the Public Class Form1 insert this code
Code:
Dim game As New TcpClient()
Dim auth As New TcpClient()
the game dim is for the game server state and auth is for auth server state
then for the code of the status you can but it any were you want in the form load if you want it to see if the the server is off or on when the launcher is started or in a button so the player can manual see it
you will need also two labels to in your form

and this is the link for the FULL launcher just edit the IP and PORT
download form :
Screenshoots
if it's not online
and when it's online
i hope you like it , and if you had any problem please post in this topic or pm .

have a nice day.
What this script automatically change the status when the server is down?
because when i'm test to start and down server, a launcher doesn't automatically change status online and offline
deenat is offline  
Old 01/28/2012, 11:37   #10
 
M>M's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 264
Received Thanks: 240
Quote:
Originally Posted by deenat View Post
What this script automatically change the status when the server is down?
because when i'm test to start and down server, a launcher doesn't automatically change status online and offline
just add the try code to a timer so it check it every sec
M>M is offline  
Thanks
1 User
Old 06/18/2012, 02:37   #11
 
elite*gold: 0
Join Date: Apr 2011
Posts: 1
Received Thanks: 0
thanks for the share can anyone tell me what does mean by import "Imports System.Net.Sockets" i dont get this part . am noob with vb so am kinda clueless and dont know where to put it
can anyone guide me plz thanks for reading
sadaathere is offline  
Old 06/19/2012, 22:13   #12
 
elite*gold: 0
Join Date: Jun 2011
Posts: 73
Received Thanks: 37
And now just for fun c++ Code :P

Code:
using namespace std;

WSADATA wsa;
SOCKET s;
SOCKADDR_IN addr;

if(WSAStartup(MAKEWORD(2,2),&wsa)!=0)
{
  cout << "WinSock couldnt be initialized! , fehler code: " << WSAGetLastError(); 
}

s=socket(AF_INET,SOCK_STREAM,0);
memset(&addr,0,sizeof(SOCKADDR_IN));
addr.sin_family=AF_INET;
addr.sin_port=htons(4515); //Enter Port here
addr.sin_addr.s_addr=inet_addr("127.0.0.1"); // Enter IP here
long rc=connect(s,(SOCKADDR*)&addr,sizeof(SOCKADDR));
if(rc==SOCKET_ERROR)
{
        cout << "Fehler: connect gescheitert, fehler code:" << WSAGetLastError() << endl;
        return;
}
if(s==INVALID_SOCKET)
{
        cout << "Fehler: Der Socket konnte nicht erstellt werden, fehler code:" << WSAGetLastError() << endl;
        return;
}

//Server ist online - Code hier


closesocket(s);
WSACleanup();
Turtlefight is offline  
Old 11/28/2012, 00:05   #13
 
nixonpogi's Avatar
 
elite*gold: 0
Join Date: Nov 2011
Posts: 35
Received Thanks: 1
This tutorial is not working with me. Offline/Online server status not working.

though I followed everything in the tutorial
nixonpogi is offline  
Old 11/28/2012, 01:38   #14
 
TheOnlyOneRaskim's Avatar
 
elite*gold: 0
Join Date: Nov 2011
Posts: 978
Received Thanks: 1,011
Let dead post rest in peace....
TheOnlyOneRaskim is offline  
Old 11/28/2012, 15:51   #15
 
elite*gold: 0
Join Date: Aug 2012
Posts: 1
Received Thanks: 0
Cool c# status server

Code:
TcpClient TcpScan = new TcpClient();
var iar = TcpScan.BeginConnect(server, port, ConnectCallback, TcpScan);
if (!iar.AsyncWaitHandle.WaitOne(700, false))
{
	TcpScan.Close();
	return false; //Server offline
}
else
{
	TcpScan.Close();
	return true; //Server online
}
xVudijer is offline  
Reply


Similar Threads Similar Threads
[Release] Free P-Server Launcher
08/29/2010 - WoW Private Server - 4 Replies
-
[Release] If you wanna call it a release. Server status form in php!
06/25/2010 - CO2 PServer Guides & Releases - 10 Replies
Ok, got bored so made this.. serverstatus.php : <html> <head> <title>Server Status!</title> </head>



All times are GMT +2. The time now is 00:54.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.