static void Main(string[] args) { pipeLineDeph = int.Parse(args.FirstOrDefault(f => f.StartsWith("-p"))?.Substring(2) ?? "16"); int connections = int.Parse(args.FirstOrDefault(f => f.StartsWith("-c"))?.Substring(2) ?? "1024"); Console.WriteLine("RioSharp http server"); Console.WriteLine("Optimizing for " + connections + " connections"); Console.WriteLine("Optimizing for pipeline depth of: " + pipeLineDeph); sendPool = new RioFixedBufferPool(10 * connections, 256 * pipeLineDeph); recivePool = new RioFixedBufferPool(10 * connections, 256 * pipeLineDeph); listener = new RioTcpListener(sendPool, recivePool, (uint)connections); currentSegment = listener.PreAllocateWrite(GetResponse()); responseBytes = GetResponse(); //Task.Run(async () => //{ // while (true) // { // UpdateResponse(); // await Task.Delay(60000); // } //}); listener.OnAccepted = new Action<RioSocket>(s => ThreadPool.QueueUserWorkItem(o => Servebuff((RioSocket)o), s)); listener.Listen(new IPEndPoint(new IPAddress(new byte[] { 0, 0, 0, 0 }), 5000), 1024 * connections); Console.WriteLine("Listening on : http://localhost:5000"); Console.WriteLine("Press enter to exit"); Console.ReadLine(); listener.Dispose(); }
static void Main(string[] args) { pipeLineDeph = int.Parse(args.FirstOrDefault(f => f.StartsWith("-p"))?.Substring(2) ?? "16"); int connections = int.Parse(args.FirstOrDefault(f => f.StartsWith("-c"))?.Substring(2) ?? "1024"); sendPool = new RioFixedBufferPool(10 * connections, 140 * pipeLineDeph); recivePool = new RioFixedBufferPool(10 * connections, 128 * pipeLineDeph); listener = new RioTcpListener(sendPool, recivePool, 1024); currentSegment = listener.PreAllocateWrite(GetResponse()); responseBytes = GetResponse(); //Task.Run(async () => //{ // while (true) // { // UpdateResponse(); // await Task.Delay(60000); // } //}); listener.OnAccepted = new Action<RioConnectionOrientedSocket>(s => ThreadPool.QueueUserWorkItem(o => Servebuff((RioConnectionOrientedSocket)o), s)); listener.Listen(new IPEndPoint(new IPAddress(new byte[] { 0, 0, 0, 0 }), 5000), 1024 * connections); Console.ReadLine(); }