public static void LoadLocal() { string policy = LocalPolicy; _server = new SocketPolicyServer(policy); int result = _server.Start(); }
/// <summary> /// Initializes the various modules required by the server. /// Called after LoadSettings and before Update. /// </summary> public virtual void Init() { Running = true; //CommandInput = new CommandExecuter(); SocketPolicyServer.LoadPort(AppSettings.UdpPort, AppSettings.UdpPort); Server = new AsyncServer(AppSettings.TcpPort, AppSettings.UdpPort); Server.AddCommands(this); }
public static void Stop() { if (_server != null) { _server.listen_socket.Close(); _server._run = false; _server = null; } }
public static void LoadPort(int startPort, int endPort) { string policy = string.Format( @"<?xml version='1.0'?> <cross-domain-policy> <allow-access-from domain=""*"" to-ports=""{0}-{1}"" /> </cross-domain-policy>", startPort, endPort); _server = new SocketPolicyServer(policy); int result = _server.Start(); }
public static void LoadFile(string filename) { string policy = string.Empty; if (!File.Exists(filename)) { Logger.LogError("Could not find policy file '{0}'.", filename); ; return; } using (StreamReader sr = new StreamReader(filename)) { policy = sr.ReadToEnd(); } _server = new SocketPolicyServer(policy); int result = _server.Start(); }
/// <summary> /// Dispose various modules used by the server. /// </summary> public virtual void Dispose() { Logger.Log("disposing..."); Running = false; _resetEvent.Dispose(); if (Server != null) { Server.Stop(true); Server = null; } /*if (CommandInput != null) { CommandInput.Close(); }*/ SocketPolicyServer.Stop(); TaskQueue.Close(); Logger.Log("disposed!"); }