public Listener(TcpServerConfig config, ServerEndPoint serverEndPoint, ILoger loger) { this.config = config; this.server = new AsyncServer(config.MaxBufferPoolSize, config.BufferSize, config.MaxConnections, loger); this.server.Name = serverEndPoint.Name; this.localEndPoint = new IPEndPoint(IPAddress.Parse(serverEndPoint.IP), serverEndPoint.Port); }
public Listener(TcpServerConfig config, ServerEndPoint serverEndPoint,ILoger loger) { this.config = config; this.server = new AsyncServer(config.MaxBufferPoolSize,config.BufferSize,config.MaxConnections,loger); this.server.Name = serverEndPoint.Name; this.localEndPoint = new IPEndPoint(IPAddress.Parse(serverEndPoint.IP), serverEndPoint.Port); }
static void Main(string[] args) { var loger = new Loger(); var config = new TcpServerConfig(); config.BufferSize = 1024 * 4; config.MaxConnections = 100000; Framework.Listener listener = new Framework.Listener(config,new ServerEndPoint() {Name="one",IP="127.0.0.1",Port=9989 }, loger); listener.AsyncServer.OnReceived += ReceiveCommond; listener.Start(); Framework.Listener listenerOne = new Framework.Listener(config, new ServerEndPoint() { Name = "one", IP = "127.0.0.1", Port = 9988 }, loger); listenerOne.AsyncServer.OnReceived += ReceiveCommond; listenerOne.Start(); Console.WriteLine("服务器已启动"); Console.ReadLine(); }