示例#1
0
        /// <summary>
        /// Processes the connection.
        /// </summary>
        public void ProcessConnection()
        {
            try
            {
                var dataBuffer = new byte[65536];

                while (true)
                {
                    int byteCount = socket.Receive(dataBuffer);
                    if (byteCount > 0)
                    {
                        DataAssembler.Deserialize(dataBuffer, 0, byteCount);
                    }
                }
            }
            catch (IOException e)
            {
                Console.Error.WriteLine("Error receiving data from client. Did client disconnect?");
                Console.Error.WriteLine("Error message: {0}", e.Message);
                Console.Error.WriteLine(e.StackTrace);
            }
            finally
            {
                socket.Close();
                RemoveSelf();
                StatsHolder.Remove(StatsHolder.Engine);
                StatsHolder.Remove(StatsHolder.Server);
                StatsHolder.Remove(StatsHolder.EndToEnd);
            }
        }
示例#2
0
文件: Server.cs 项目: ikvm/nesper
 public void DisplayStatistics(Object userData)
 {
     StatsHolder.Dump("engine");
     StatsHolder.Dump("server");
     StatsHolder.Dump("endToEnd");
     StatsHolder.Reset();
     if (simulationRate <= 0)
     {
         ClientConnection.DumpStats(statSec);
     }
     else
     {
         SimulateClientConnection.DumpStats(statSec);
     }
 }