public void Start(IPEndPoint addr, string path, ServerConfig conf) { spawn = new Spawn(this); spawn.LogMessageEvent += new eWoW.Spawn.LogMessageHandler(spawn_LogMessageEvent); remote = "GameServer"; dbPath = path; type = conf.ServerRules; name = conf.ServerName; db = new GameDB(this, path); LoadScript(); LoadWorld(); sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); sock.Bind(addr); sock.Listen(5); SetTimerFunction("GameServerTick", 1000, new TimerFunction(OnTick)); SetTimerFunction("GameServerTick100ms", 100, new TimerFunction(OnTick100ms)); ServerGroup.SetHandle(ServerGroupMessageType.UserReply, new ServerGroupHandler(OnMsgHandler)); ServerGroup.SetHandle(ServerGroupMessageType.UserLogin, new ServerGroupHandler(OnMsgHandler)); _channel = new Channel(this); LogMessage("Start at " + name + " " + addr.ToString()); }
public RealmList(ushort port, string accountPath) { remote = "RealmList"; sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); sock.Bind(new IPEndPoint(IPAddress.Any, port)); sock.Listen(5); accounts = new DBDir(accountPath); SetTimerFunction("RealmListTick", 1000, new TimerFunction(OnTick)); ServerGroup.SetHandle(ServerGroupMessageType.GameServerHeartBeat, new ServerGroupHandler(OnMsgHandler)); ServerGroup.SetHandle(ServerGroupMessageType.UserQuery, new ServerGroupHandler(OnMsgHandler)); ServerGroup.SetHandle(ServerGroupMessageType.UserSetChar, new ServerGroupHandler(OnMsgHandler)); if (LogMessageEvent != null) { LogMessageEvent("start port={0} account={1} port:" + port + "accounts" + accounts.Count()); } }