コード例 #1
0
        public static void LoadLocal()
        {
            string policy = LocalPolicy;

            _server = new SocketPolicyServer(policy);
            int result = _server.Start();
        }
コード例 #2
0
ファイル: ServerBase.cs プロジェクト: JonRurka/VoxelTerrain
 /// <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);
 }
コード例 #3
0
 public static void Stop()
 {
     if (_server != null)
     {
         _server.listen_socket.Close();
         _server._run = false;
         _server      = null;
     }
 }
コード例 #4
0
        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();
        }
コード例 #5
0
        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();
        }
コード例 #6
0
ファイル: ServerBase.cs プロジェクト: JonRurka/VoxelTerrain
 /// <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!");
 }