diff --git a/SocketStudy/ClientForm/App.config b/SocketStudy/ClientForm/App.config index aee9adf..a1bf4bc 100644 --- a/SocketStudy/ClientForm/App.config +++ b/SocketStudy/ClientForm/App.config @@ -1,6 +1,24 @@  + + +
+ + + + + + 127.0.0.1 + + + 37777 + + + 37779 + + + \ No newline at end of file diff --git a/SocketStudy/ClientForm/MainForm.Designer.cs b/SocketStudy/ClientForm/MainForm.Designer.cs index 31c9dcf..59276eb 100644 --- a/SocketStudy/ClientForm/MainForm.Designer.cs +++ b/SocketStudy/ClientForm/MainForm.Designer.cs @@ -32,23 +32,20 @@ namespace ClientForm System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.logConsole = new System.Windows.Forms.TextBox(); this.mainTablePanel = new System.Windows.Forms.TableLayoutPanel(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.panel1 = new System.Windows.Forms.Panel(); - this.stringButton = new System.Windows.Forms.Button(); - this.fileButton = new System.Windows.Forms.Button(); - this.objectButton = new System.Windows.Forms.Button(); - this.imageButton = new System.Windows.Forms.Button(); - this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.startButton = new System.Windows.Forms.Button(); this.statusStrip = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.heartBeatStatus = new System.Windows.Forms.ToolStripStatusLabel(); - this.addressTextBox = new System.Windows.Forms.TextBox(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.imageButton = new System.Windows.Forms.Button(); + this.objectButton = new System.Windows.Forms.Button(); + this.fileButton = new System.Windows.Forms.Button(); + this.stringButton = new System.Windows.Forms.Button(); + this.startButton = new System.Windows.Forms.Button(); + this.panel1 = new System.Windows.Forms.Panel(); this.mainTablePanel.SuspendLayout(); + this.statusStrip.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.panel1.SuspendLayout(); - this.tableLayoutPanel2.SuspendLayout(); - this.statusStrip.SuspendLayout(); this.SuspendLayout(); // // logConsole @@ -61,7 +58,7 @@ namespace ClientForm this.logConsole.Multiline = true; this.logConsole.Name = "logConsole"; this.logConsole.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.logConsole.Size = new System.Drawing.Size(578, 393); + this.logConsole.Size = new System.Drawing.Size(606, 350); this.logConsole.TabIndex = 1; // // mainTablePanel @@ -76,47 +73,68 @@ namespace ClientForm this.mainTablePanel.RowCount = 2; this.mainTablePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 60F)); this.mainTablePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.mainTablePanel.Size = new System.Drawing.Size(584, 461); + this.mainTablePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.mainTablePanel.Size = new System.Drawing.Size(612, 418); this.mainTablePanel.TabIndex = 3; // + // statusStrip + // + this.statusStrip.ImageScalingSize = new System.Drawing.Size(20, 20); + this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1, + this.heartBeatStatus}); + this.statusStrip.Location = new System.Drawing.Point(0, 396); + this.statusStrip.Name = "statusStrip"; + this.statusStrip.Size = new System.Drawing.Size(612, 22); + this.statusStrip.TabIndex = 4; + this.statusStrip.Text = "statusStrip1"; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(0, 17); + // + // heartBeatStatus + // + this.heartBeatStatus.Name = "heartBeatStatus"; + this.heartBeatStatus.Size = new System.Drawing.Size(0, 17); + // // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 200F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.Controls.Add(this.startButton, 0, 0); this.tableLayoutPanel1.Controls.Add(this.panel1, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(584, 60); + this.tableLayoutPanel1.Size = new System.Drawing.Size(612, 60); this.tableLayoutPanel1.TabIndex = 2; // - // panel1 + // imageButton // - this.panel1.Controls.Add(this.stringButton); - this.panel1.Controls.Add(this.fileButton); - this.panel1.Controls.Add(this.objectButton); - this.panel1.Controls.Add(this.imageButton); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(203, 3); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(378, 54); - this.panel1.TabIndex = 4; + this.imageButton.Location = new System.Drawing.Point(191, 15); + this.imageButton.Name = "imageButton"; + this.imageButton.Size = new System.Drawing.Size(75, 23); + this.imageButton.TabIndex = 2; + this.imageButton.Text = "image"; + this.imageButton.UseVisualStyleBackColor = true; + this.imageButton.Click += new System.EventHandler(this.imageButton_Click); // - // stringButton + // objectButton // - this.stringButton.Location = new System.Drawing.Point(29, 15); - this.stringButton.Name = "stringButton"; - this.stringButton.Size = new System.Drawing.Size(75, 23); - this.stringButton.TabIndex = 2; - this.stringButton.Text = "string"; - this.stringButton.UseVisualStyleBackColor = true; - this.stringButton.Click += new System.EventHandler(this.stringButton_Click); + this.objectButton.Location = new System.Drawing.Point(110, 15); + this.objectButton.Name = "objectButton"; + this.objectButton.Size = new System.Drawing.Size(75, 23); + this.objectButton.TabIndex = 2; + this.objectButton.Text = "object"; + this.objectButton.UseVisualStyleBackColor = true; + this.objectButton.Click += new System.EventHandler(this.objectButton_Click); // // fileButton // @@ -128,88 +146,44 @@ namespace ClientForm this.fileButton.UseVisualStyleBackColor = true; this.fileButton.Click += new System.EventHandler(this.fileButton_Click); // - // objectButton - // - this.objectButton.Location = new System.Drawing.Point(110, 15); - this.objectButton.Name = "objectButton"; - this.objectButton.Size = new System.Drawing.Size(75, 23); - this.objectButton.TabIndex = 2; - this.objectButton.Text = "object"; - this.objectButton.UseVisualStyleBackColor = true; - this.objectButton.Click += new System.EventHandler(this.objectButton_Click); - // - // imageButton - // - this.imageButton.Location = new System.Drawing.Point(191, 15); - this.imageButton.Name = "imageButton"; - this.imageButton.Size = new System.Drawing.Size(75, 23); - this.imageButton.TabIndex = 2; - this.imageButton.Text = "image"; - this.imageButton.UseVisualStyleBackColor = true; - this.imageButton.Click += new System.EventHandler(this.imageButton_Click); + // stringButton // - // tableLayoutPanel2 - // - this.tableLayoutPanel2.ColumnCount = 1; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.Controls.Add(this.startButton, 0, 1); - this.tableLayoutPanel2.Controls.Add(this.addressTextBox, 0, 0); - this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3); - this.tableLayoutPanel2.Name = "tableLayoutPanel2"; - this.tableLayoutPanel2.RowCount = 2; - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(194, 54); - this.tableLayoutPanel2.TabIndex = 5; + this.stringButton.Location = new System.Drawing.Point(29, 15); + this.stringButton.Name = "stringButton"; + this.stringButton.Size = new System.Drawing.Size(75, 23); + this.stringButton.TabIndex = 2; + this.stringButton.Text = "string"; + this.stringButton.UseVisualStyleBackColor = true; + this.stringButton.Click += new System.EventHandler(this.stringButton_Click); // // startButton // this.startButton.Dock = System.Windows.Forms.DockStyle.Fill; - this.startButton.Location = new System.Drawing.Point(3, 30); + this.startButton.Location = new System.Drawing.Point(3, 3); this.startButton.Name = "startButton"; - this.startButton.Size = new System.Drawing.Size(188, 21); + this.startButton.Size = new System.Drawing.Size(194, 54); this.startButton.TabIndex = 0; this.startButton.Text = "Connect"; this.startButton.UseVisualStyleBackColor = true; this.startButton.Click += new System.EventHandler(this.startButton_Click); // - // statusStrip - // - this.statusStrip.ImageScalingSize = new System.Drawing.Size(20, 20); - this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripStatusLabel1, - this.heartBeatStatus}); - this.statusStrip.Location = new System.Drawing.Point(0, 439); - this.statusStrip.Name = "statusStrip"; - this.statusStrip.Size = new System.Drawing.Size(584, 22); - this.statusStrip.TabIndex = 4; - this.statusStrip.Text = "statusStrip1"; - // - // toolStripStatusLabel1 - // - this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; - this.toolStripStatusLabel1.Size = new System.Drawing.Size(0, 17); - // - // heartBeatStatus - // - this.heartBeatStatus.Name = "heartBeatStatus"; - this.heartBeatStatus.Size = new System.Drawing.Size(0, 17); - // - // addressTextBox + // panel1 // - this.addressTextBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.addressTextBox.Location = new System.Drawing.Point(3, 3); - this.addressTextBox.Name = "addressTextBox"; - this.addressTextBox.Size = new System.Drawing.Size(188, 21); - this.addressTextBox.TabIndex = 1; - this.addressTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.panel1.Controls.Add(this.stringButton); + this.panel1.Controls.Add(this.fileButton); + this.panel1.Controls.Add(this.objectButton); + this.panel1.Controls.Add(this.imageButton); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(203, 3); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(406, 54); + this.panel1.TabIndex = 4; // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(584, 461); + this.ClientSize = new System.Drawing.Size(612, 418); this.Controls.Add(this.statusStrip); this.Controls.Add(this.mainTablePanel); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -217,12 +191,10 @@ namespace ClientForm this.Text = "Client"; this.mainTablePanel.ResumeLayout(false); this.mainTablePanel.PerformLayout(); - this.tableLayoutPanel1.ResumeLayout(false); - this.panel1.ResumeLayout(false); - this.tableLayoutPanel2.ResumeLayout(false); - this.tableLayoutPanel2.PerformLayout(); this.statusStrip.ResumeLayout(false); this.statusStrip.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); + this.panel1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -236,14 +208,12 @@ namespace ClientForm private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; private System.Windows.Forms.ToolStripStatusLabel heartBeatStatus; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Button startButton; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button stringButton; private System.Windows.Forms.Button fileButton; private System.Windows.Forms.Button objectButton; private System.Windows.Forms.Button imageButton; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; - private System.Windows.Forms.Button startButton; - private System.Windows.Forms.TextBox addressTextBox; } } diff --git a/SocketStudy/ClientForm/MainForm.cs b/SocketStudy/ClientForm/MainForm.cs index 2ff095d..371aa78 100644 --- a/SocketStudy/ClientForm/MainForm.cs +++ b/SocketStudy/ClientForm/MainForm.cs @@ -21,8 +21,9 @@ namespace ClientForm public partial class MainForm : Form { - private readonly int PORT = 37777; - private readonly int HB_PORT = 37778; + private string serverIP = "127.0.0.1"; + private int serverPort = 37777; + private int heartBeatPort = 37778; private PClient heartBeatClient; private PClient client; @@ -36,6 +37,15 @@ namespace ClientForm public MainForm() { InitializeComponent(); + InitInstance(); + } + + private void InitInstance() + { + //AppSetting.Default.SetValue("SERVER_IP", "127.0.0.105"); + serverIP = AppSetting.Default.GetValue("SERVER_IP", "127.0.0.1"); + serverPort = AppSetting.Default.GetValue("PORT", 37777); + heartBeatPort = AppSetting.Default.GetValue("HB_PORT", 37778); } private void ConnectToServer(string address) @@ -50,14 +60,14 @@ namespace ClientForm logHandler = new LogHandler(WriteLog); formHandler = new FormHandler(ShowForm); - heartBeatClient = new PClient(ipAddress, HB_PORT, heartBeatClientId); + heartBeatClient = new PClient(ipAddress, heartBeatPort, heartBeatClientId); heartBeatClient.OnConnected += CommonClient_OnConnected; heartBeatClient.OnSend += HeartBeatClient_OnSend; heartBeatClient.OnReceived += HeartBeatClient_OnReceived; heartBeatClient.OnErrorCatched += CommonClient_OnErrorCatched; heartBeatClient.OnDisconnected += CommonClient_OnDisconnected; - client = new PClient(ipAddress, PORT, clientId); + client = new PClient(ipAddress, serverPort, clientId); client.OnConnected += CommonClient_OnConnected; client.OnSend += Client_OnSend; client.OnReceived += Client_OnReceived; @@ -248,27 +258,14 @@ namespace ClientForm private void startButton_Click(object sender, EventArgs e) { - if (startButton.Text == "Connect") + if (string.IsNullOrEmpty(serverIP)) { - startButton.Text = "Disconnect"; - - string address = addressTextBox.Text; - if (string.IsNullOrEmpty(address)) - { - MessageBox.Show("Empty address"); - return; - } - - ConnectToServer(address); - addressTextBox.Enabled = false; + MessageBox.Show("Empty address"); + return; } - else - { - startButton.Text = "Connect"; - DisconnectFromServer(); - addressTextBox.Enabled = true; - } + ConnectToServer(serverIP); + startButton.Enabled = false; } } } diff --git a/SocketStudy/ClientForm/Properties/Settings.Designer.cs b/SocketStudy/ClientForm/Properties/Settings.Designer.cs index 43c130e..1e25f24 100644 --- a/SocketStudy/ClientForm/Properties/Settings.Designer.cs +++ b/SocketStudy/ClientForm/Properties/Settings.Designer.cs @@ -1,29 +1,62 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// 이 코드는 도구를 사용하여 생성되었습니다. +// 런타임 버전:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 +// 이러한 변경 내용이 손실됩니다. // //------------------------------------------------------------------------------ - -namespace ClientForm.Properties -{ - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } +namespace ClientForm.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("127.0.0.1")] + public string SERVER_IP { + get { + return ((string)(this["SERVER_IP"])); + } + set { + this["SERVER_IP"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("37777")] + public string PORT { + get { + return ((string)(this["PORT"])); + } + set { + this["PORT"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("37779")] + public string HB_PORT { + get { + return ((string)(this["HB_PORT"])); + } + set { + this["HB_PORT"] = value; + } + } + } } diff --git a/SocketStudy/ClientForm/Properties/Settings.settings b/SocketStudy/ClientForm/Properties/Settings.settings index 3964565..7d7d68b 100644 --- a/SocketStudy/ClientForm/Properties/Settings.settings +++ b/SocketStudy/ClientForm/Properties/Settings.settings @@ -1,7 +1,15 @@  - - - - - - + + + + + 127.0.0.1 + + + 37777 + + + 37779 + + + \ No newline at end of file diff --git a/SocketStudy/PUtil/AppSetting.cs b/SocketStudy/PUtil/AppSetting.cs new file mode 100644 index 0000000..0ea0a2e --- /dev/null +++ b/SocketStudy/PUtil/AppSetting.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PUtility +{ + public class AppSetting + { + public static AppSetting Default { get; set; } = new AppSetting(); + + public string ConfigFileName { get; private set; } + private Configuration configuration; + public Configuration Config + { + get + { + if (configuration == null) + { + if (string.IsNullOrEmpty(ConfigFileName)) + { + configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); + } + else + { + ExeConfigurationFileMap configMap = new ExeConfigurationFileMap(); + configMap.ExeConfigFilename = this.ConfigFileName; + configuration = ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None); + } + } + + return configuration; + } + } + + public AppSetting(string fileName = null) + { + InitInstance(fileName); + } + + private void InitInstance(string fileName) + { + this.ConfigFileName = fileName; + } + + public void Refresh() + { + configuration = null; + } + + public T GetValue(string key, T defaultValue) + { + if (this.Config.AppSettings.Settings[key] == null) + return defaultValue; + + string source = this.Config.AppSettings.Settings[key].Value; + + TypeConverter converter = TypeDescriptor.GetConverter(typeof(T)); + try + { + return (T)converter.ConvertFromString(source); + } + catch (Exception ex) + { + PFileManager.Instance.WriteLog($"AppSetting.GetValue Exception: {ex.Message}"); + return defaultValue; + } + } + + public void SetValue(string key, T value) + { + Refresh(); + + TypeConverter converter = TypeDescriptor.GetConverter(typeof(T)); + string valueString = converter.ConvertToString(value); + + if (this.Config.AppSettings.Settings[key] == null) + this.Config.AppSettings.Settings.Add(key, valueString); + else + this.Config.AppSettings.Settings[key].Value = valueString; + + this.Config.Save(); + + if (string.IsNullOrEmpty(ConfigFileName)) + ConfigurationManager.RefreshSection("appSettings"); + } + } +} diff --git a/SocketStudy/PUtil/PUtility.csproj b/SocketStudy/PUtil/PUtility.csproj index aadc2a4..b4ea037 100644 --- a/SocketStudy/PUtil/PUtility.csproj +++ b/SocketStudy/PUtil/PUtility.csproj @@ -50,6 +50,7 @@ + @@ -61,6 +62,7 @@ + diff --git a/SocketStudy/ServerForm/App.config b/SocketStudy/ServerForm/App.config index aee9adf..c06b49c 100644 --- a/SocketStudy/ServerForm/App.config +++ b/SocketStudy/ServerForm/App.config @@ -1,6 +1,21 @@  + + +
+ + + + + + 37777 + + + 37778 + + + \ No newline at end of file diff --git a/SocketStudy/ServerForm/MainForm.cs b/SocketStudy/ServerForm/MainForm.cs index 7034b04..aa0786c 100644 --- a/SocketStudy/ServerForm/MainForm.cs +++ b/SocketStudy/ServerForm/MainForm.cs @@ -19,8 +19,8 @@ namespace ServerForm public partial class MainForm : Form { - private readonly int PORT = 37777; - private readonly int HB_PORT = 37778; + private int serverPort = 37777; + private int heartBeatPort = 37778; private PServer mainServer; private PServer heartBeatServer; @@ -39,10 +39,11 @@ namespace ServerForm private void InitInstance() { - string path = Application.StartupPath; + serverPort = AppSetting.Default.GetValue("PORT", 37777); + heartBeatPort = AppSetting.Default.GetValue("HB_PORT", 37778); - heartBeatServer = new PServer(HB_PORT); - mainServer = new PServer(PORT); + heartBeatServer = new PServer(heartBeatPort); + mainServer = new PServer(serverPort); logHandler = new LogHandler(WriteLog); formHandler = new FormHandler(ShowForm); diff --git a/SocketStudy/ServerForm/Properties/Settings.Designer.cs b/SocketStudy/ServerForm/Properties/Settings.Designer.cs index 9900aa2..b1246cd 100644 --- a/SocketStudy/ServerForm/Properties/Settings.Designer.cs +++ b/SocketStudy/ServerForm/Properties/Settings.Designer.cs @@ -1,29 +1,50 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// 이 코드는 도구를 사용하여 생성되었습니다. +// 런타임 버전:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 +// 이러한 변경 내용이 손실됩니다. // //------------------------------------------------------------------------------ - -namespace ServerForm.Properties -{ - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } +namespace ServerForm.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("37777")] + public string PORT { + get { + return ((string)(this["PORT"])); + } + set { + this["PORT"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("37778")] + public string HB_PORT { + get { + return ((string)(this["HB_PORT"])); + } + set { + this["HB_PORT"] = value; + } + } + } } diff --git a/SocketStudy/ServerForm/Properties/Settings.settings b/SocketStudy/ServerForm/Properties/Settings.settings index 3964565..6486a8f 100644 --- a/SocketStudy/ServerForm/Properties/Settings.settings +++ b/SocketStudy/ServerForm/Properties/Settings.settings @@ -1,7 +1,12 @@  - - - - - - + + + + + 37777 + + + 37778 + + + \ No newline at end of file