protected ToolDlg(Kernel kernel,string nameTag,Object obj,string caption) { InitializeComponent(); Kernel = kernel; NameTag = nameTag; _caption = caption; if (kernel.RunMode == RunMode.Remote) { sockTcp = (SockTcp)obj; } else { Server = (OneServer)obj; } Text = caption; //ウインドウサイズの復元 kernel.WindowSize.Read(this); //MainMenuFile.Text = (kernel.IsJp()) ? "ファイル(&F)" : "&File"; //MainMenuClose.Text = (kernel.IsJp()) ? "閉じる(&C)" : "&Close"; }
private readonly OneServer _v6Sv; //サーバ #endregion Fields #region Constructors public TestServer(TestServerType type,String iniSubDir,String iniFileName) { var confName = type == TestServerType.Pop ? "Pop3" : "Smtp"; //設定ファイルの退避と上書き _op = new TmpOption(iniSubDir,iniFileName); var kernel = new Kernel(); var option = kernel.ListOption.Get(confName); var conf = new Conf(option); //サーバ起動 if (type == TestServerType.Pop){ _v4Sv = new Pop3Server.Server(kernel, conf, new OneBind(new Ip(IpKind.V4Localhost), ProtocolKind.Tcp)); _v6Sv = new Pop3Server.Server(kernel, conf, new OneBind(new Ip(IpKind.V6Localhost), ProtocolKind.Tcp)); } else { _v4Sv = new SmtpServer.Server(kernel, conf, new OneBind(new Ip(IpKind.V4Localhost), ProtocolKind.Tcp)); _v6Sv = new SmtpServer.Server(kernel, conf, new OneBind(new Ip(IpKind.V6Localhost), ProtocolKind.Tcp)); } _v4Sv.Start(); _v6Sv.Start(); Thread.Sleep(100); //少し余裕がないと多重でテストした場合に、サーバが起動しきらないうちにクライアントからの接続が始まってしまう。 }