Register for your free account! | Forgot your password?

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

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

Advertisement



CoEmu v2 Plyz Need help faster

Discussion on CoEmu v2 Plyz Need help faster within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
sawickas's Avatar
 
elite*gold: 0
Join Date: Sep 2008
Posts: 617
Received Thanks: 38
CoEmu v2 Plyz Need help faster

/*
* Created by SharpDevelop.
* User: sams
* Date: 3/8/2009
* Time: 1:13 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using MySql.Data.MySqlClient;

namespace CoEmu_v2_GameServer.Database
{
/// <summary>
/// Provides MySql resource connections, for multiple connections to a single MySql database.
/// This is due to the fact that the server is multi-threaded, so allowing a single connection would
/// likely result in errors, or general loss of performance.
/// </summary>
public static class DatabaseConnection
{
public const string USER_NAME = "root";
public const string PASSWORD = "test";
public const string SERVER = "127.0.0.1";
public const string DATA_BASE = "conqueremu";
public static MySqlConnection NewConnection()
{
MySqlConnection C = null;
try{
C = new MySqlConnection("Server=" + SERVER + ";Database='" + DATA_BASE + "';Username='" + USER_NAME + "';Password='" + PASSWORD + "'; Min Pool Size = 300; Max Pool Size = 900");
C.Open();
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
return null;
}
return C;
}
}
}



















/*
* Created by SharpDevelop.
* User: sams
* Date: 3/4/2009
* Time: 5:37 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using CoEmu_v2_GameServer.Connections;

namespace CoEmu_v2_GameServer.Connections
{
/// <summary>
/// The Master socket thread.
/// </summary>
public class MasterSocket
{
protected Socket ServerSocket;
protected const int LOGIN_PORT = 9958;
protected const string SERVER_IP = "127.0.0.1";
protected const string SITE_IP = "127.0.0.1";
protected const int AUTH_PORT = 5817;
protected const int GAME_PORT = 5816;
protected string ServerName;
protected static bool Continue = true;

public MasterSocket(string name)
{
ServerName = name;
if(name == "GameServer")
{
ServerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint IPE = new IPEndPoint(new IPAddress(0), GAME_PORT);
try{
ServerSocket.Bind(IPE);
}
catch(Exception e)
{
Console.WriteLine("["+name+"-Init] Failed, unable to bind server to socket.");
Console.WriteLine(e.StackTrace);
System.Environment.Exit(-1);
}
}
else if(name == "AuthServer")
{
ServerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint IPE = new IPEndPoint(new IPAddress(0), AUTH_PORT);
try{
ServerSocket.Bind(IPE);
}
catch(Exception e)
{
Console.WriteLine("["+name+"-Init] Failed, unable to bind server to socket.");
Console.WriteLine(e.StackTrace);
System.Environment.Exit(-1);
}
}
}

public void AcceptNewConnections()
{
ServerSocket.Listen(100);
while(Continue)
{
if(ServerName == "GameServer")
{
Socket CSocket = null;
try{
CSocket = ServerSocket.Accept();
}
catch(Exception e)
{
Console.WriteLine("Unable to accept a new connection, closing now.");
ServerSocket.Close();
Console.WriteLine(e.StackTrace);
return;
}
try
{
if(CSocket.Connected)
{
if(!CSocket.RemoteEndPoint.ToString().Contains(SIT E_IP))
{
ClientSocket CS = new ClientSocket(CSocket);
new Thread(CS.Run).Start();
}
else
{
CSocket.Close();
}
}
}
catch(Exception e)
{
if(CSocket != null)
CSocket.Close();
Console.WriteLine("[GameServer] Unable to login a new client, see exception print below.");
Console.WriteLine(e.ToString());
}
}
else if(ServerName == "AuthServer")
{
Socket ASocket = null;
try{
ASocket = ServerSocket.Accept();
}
catch(Exception e)
{
Console.WriteLine("Unable to accept data from Auth Server.");
ServerSocket.Close();
Console.WriteLine(e.ToString());
return;
}
if(ASocket != null)
{
try{
//AuthHandler.NewAuth(ASocket);
byte[] Buffer = new byte[8092];
int size = ASocket.Receive(Buffer);
byte[] Data = new byte[size];
Array.Copy(Buffer, Data, size);
AuthHandler.HandleAuth(Data);
Data = null;
Buffer = null;
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
}
}
System.Threading.Thread.Sleep(200);
}
}
public void Close()
{
Console.WriteLine("["+ServerName+"-End] Closing Socket.");
ServerSocket.Close();
Continue = false;
if(ServerName == "GameServer")
{
Nano.Continue = false;
}
}
}
}














Datebase eroor Line 34 Maby sombary can help my? paste here configs For Onli local PC Plyzzzzzz
sawickas is offline  
Reply


Similar Threads Similar Threads
Ini Not Ini Help plyz
11/23/2009 - CO2 Private Server - 5 Replies
How convert from ini to cs?
Can any one help my plyz
10/26/2009 - CO2 Private Server - 5 Replies
I get problem in coemu try find were problem but cant find :( http://img98.imageshack.us/img98/3766/newbitmapima geur.png
Plyz tell me!
07/31/2009 - EO PServer Hosting - 0 Replies
How i can add new skills and make it work thanks a lot!
Plyz help me fater
07/03/2009 - EO PServer Hosting - 17 Replies
How i can make in server max stars laike 50 for all eudemons:) And dont more :)



All times are GMT +1. The time now is 23:12.


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.