public bool ExternelServerStart() { try { DelegateState.InvokeDispatchStateEvent("正在初始化外围服务..."); string FILEPATH = Application.StartupPath + @"/sysconfig.xml"; Hashtable htServer = XMLClass.GetXMLByParentNode(FILEPATH, XMLConstClass.NODE_SERVER); string port = "2018"; string maxclient = "200"; string rcvtimeout = "100"; string sendtimeout = "100"; string buffersize = "128"; if (htServer.Contains(XMLConstClass.PORT)) { port = htServer[XMLConstClass.PORT].ToString(); } if (htServer.Contains(XMLConstClass.MAXCONNECTCOUNT)) { maxclient = htServer[XMLConstClass.MAXCONNECTCOUNT].ToString(); } if (htServer.Contains(XMLConstClass.RECTIMEOUT)) { rcvtimeout = htServer[XMLConstClass.RECTIMEOUT].ToString(); } if (htServer.Contains(XMLConstClass.SENDTIMEOUT)) { sendtimeout = htServer[XMLConstClass.SENDTIMEOUT].ToString(); } if (htServer.Contains(XMLConstClass.BUFFERSIZE)) { buffersize = htServer[XMLConstClass.BUFFERSIZE].ToString(); } IServerConfig nannyclient_serverconfig = new SocketServer.ServerConfig() { Port = Convert.ToInt16(port), MaxClientCount = Convert.ToInt16(maxclient), RecOutTime = Convert.ToInt16(rcvtimeout), ReceiveBufferSize = Convert.ToInt16(buffersize), SendBufferSize = Convert.ToInt16(buffersize) }; if (_server == null) { _server = new TCPServer(); _server.ReceiveMes += _server_ReceiveMes; } if (!_server.Setup(nannyclient_serverconfig)) { return(false); } else { if (!_server.Start()) { return(false); } } return(true); } catch (Exception ex) { DelegateState.InvokeDispatchStateEvent(ex.Message); return(false); } }
public ServerSSL(ServerConfig config) : base(config) { }