public static XIMServer CreateXIMServer(ServiceMain service) { XIMServer s = new XIMServer(); s._service = service; IEntity e = null; if (Program.ConfigMgt.Config.InboundFromFile) { e = new DirectoryMonitor(Program.ConfigMgt.Config.DirectoryConfig, Program.Log); } else { e = SocketEntity.Create(Program.ConfigMgt.Config.SocketConfig); } if (e == null) { return(null); } else { e.OnRequest += new RequestEventHandler(s._entity_OnRequest); s._entity = e; return(s); } }
private void buttonServerStart_Click(object sender, EventArgs e) { //_server = SocketEntity.Create((int)this.numericUpDownServerPort.Value); SocketConfig config = new SocketConfig(); config.Port = (int)this.numericUpDownServerPort.Value; config.ReceiveEndSign = "</XMLRequestMessage>"; config.SendEndSign = "</XMLResponseMessage>"; _server = SocketEntity.Create(config); if (_server == null) { return; } _server.OnRequest += new RequestEventHandler(_server_OnRequest); if (_server == null) { MessageBox.Show(SocketLogMgt.LastErrorInfor); } else if (_server.Start()) { this.numericUpDownServerPort.Enabled = false; } else { MessageBox.Show(SocketLogMgt.LastErrorInfor); } }