private void Save() { #region Socket parameter clientSocketParams.LocalIP = ""; clientSocketParams.LocalPort = -1; clientSocketParams.CallbackIP = this.txtCallbackIP.Text; clientSocketParams.CallbackPort = (int)this.txtCallbackPort.Value; clientSocketParams.ServerIP = this.txtServerIP.Text; clientSocketParams.ServerPort = (int)this.txtServerPort.Value; SocketOutboundAdapterConfigMgt.SocketOutAdapterConfig.OutGeneralParams.TimerInterval = Int32.Parse(this.txtInterval.Text); clientSocketParams.ConnectTimeout = Int32.Parse(this.txtConnectTimeout.Text); clientSocketParams.ConnectTryCount = Int32.Parse(this.txtTryCount.Text); clientSocketParams.RecTimeout = Int32.Parse(this.txtReceiveTimeout.Text); clientSocketParams.SendTimeout = Int32.Parse(this.txtSendTimeout.Text); clientSocketParams.CodePageName = EncodingPage.GetAllCodePages()[cbCodePage.SelectedIndex].Name; #endregion string FileName = Application.StartupPath + "\\" + SocketOutboundAdapterConfigMgt.FileName; if (!SocketOutboundAdapterConfigMgt.Save(FileName)) { if (SocketOutboundAdapterConfigMgt.LastException != null) { Program.log.Write(LogType.Error, "Cannot save information to configuration file: " + FileName); } MessageBox.Show(SocketOutboundAdapterConfigMgt.LastException.Message); } }
private void CreateClientSocket() { if (_ClientSocket == null) { _ClientSocket = new ClientSocket(_logClient); _ClientSocket.CodePageName = EncodingPage.GetAllCodePages()[cbcCodePage.SelectedIndex].Name; } }
private void InitCodePage() { this.cbCodePage.Items.Clear(); for (int i = 0; i < EncodingPage.GetAllCodePages().Length; i++) { EncodingInfo ei = EncodingPage.GetAllCodePages()[i]; cbCodePage.Items.Add(ei.DisplayName + " (" + ei.CodePage.ToString() + ")"); } }
private void CreateServerSocket() { string sListenIP = tbListenIP.Text; int iListenPort = Convert.ToInt32(tbListentPort.Text); _ServerSocket = new ServerSocket(sListenIP, iListenPort, _logServer); _ServerSocket.CodePageName = EncodingPage.GetAllCodePages()[cbsCodePage.SelectedIndex].Name; _ServerSocket.OnClientDataReceived += OnDataReceived; }
private void cbcCodePage_SelectedIndexChanged(object sender, EventArgs e) { if (_ServerSocket != null) { _ServerSocket.CodePageName = EncodingPage.GetAllCodePages()[cbsCodePage.SelectedIndex].Name; } if (_ClientSocket != null) { _ClientSocket.CodePageName = EncodingPage.GetAllCodePages()[cbcCodePage.SelectedIndex].Name; } }
private void Save() { #region Server Socket parameter ServerSocketParams.ListenIP = this.txtIP.Text; ServerSocketParams.ListenPort = Int32.Parse(this.txtPort.Text); ServerSocketParams.ConnectTimeout = Int32.Parse(this.txtConnectTimeout.Text); ServerSocketParams.ConnectTryCount = Int32.Parse(this.txtTryCount.Text); ServerSocketParams.RecTimeout = Int32.Parse(this.txtReceiveTimeout.Text); ServerSocketParams.SendTimeout = Int32.Parse(this.txtSendTimeout.Text); ServerSocketParams.CodePageName = EncodingPage.GetAllCodePages()[cbCodePage.SelectedIndex].Name; #endregion string FileName = Application.StartupPath + "\\" + SocketInboundAdapterConfigMgt.FileName; if (!SocketInboundAdapterConfigMgt.Save(FileName)) { if (SocketInboundAdapterConfigMgt.LastException != null) { Program.log.Write(LogType.Error, "Cannot save information to configuration file: " + FileName); } MessageBox.Show(SocketInboundAdapterConfigMgt.LastException.Message); } }