示例#1
0
 private void C_Write(LineReader reader, string args)
 {
     if (Write)
     {
         string script = ReadCData(reader, null);
         string[] parts = args.Split(':');
         string host = parts[0] == string.Empty ? "0.0.0.0" : parts[0];
         int port = parts.Length < 2 || string.IsNullOrEmpty(parts[1]) ? DefaultPort : Convert.ToInt32(parts[1]);
         if (_Server != null) throw new Exception("Can run only one instance of a server at port " + port);
         _Server = new RecipeServer(host, port, this, script);
         new Thread(_Server.Listen).Start();
         SendMessage("@server {0}", port);
     }
 }
示例#2
0
 public void StopServer()
 {
     if (_Server != null)
     {
         _Server.Stop();
         _Server = null;
     }
     GC.Collect();
 }