示例#1
0
 public static void StartTrinityServer(UInt16 port)
 {
     if (CNativeNetwork.StartSocketServer(port) == -1)
     {
         throw new System.Net.Sockets.SocketException();
     }
 }
示例#2
0
        public static void StartTrinityServer(UInt16 port)
        {
            // config thread pool
            int cpu_core_count = Environment.ProcessorCount;

            CNativeNetwork.StartSocketServer(port);
            StartWorkerThreadPool();
        }
示例#3
0
        public static void StartTrinityServer(UInt16 port)
        {
            if (CNativeNetwork.StartSocketServer(port) == -1)
            {
                throw new System.Net.Sockets.SocketException();
            }

            if (!CNativeNetwork.StartWorkerThreadPool())
            {
                throw new Exception("Cannot start worker thread pool");
            }
        }
示例#4
0
 internal static void WorkerThreadProc()
 {
     CNativeNetwork.EnterSocketServerThreadPool();
     while (true)
     {
         void *pContext = null;
         CNativeNetwork.AwaitRequest(out pContext);
         // a null pContext means that the completion port is closing.
         if (pContext == null)
         {
             break;
         }
         MessageBuff *sendRecvBuff = (MessageBuff *)pContext;
         HandleMessage(sendRecvBuff);
         CNativeNetwork.SendResponse(pContext); // Send response back to the client
     }
     CNativeNetwork.ExitSocketServerThreadPool();
 }
示例#5
0
 public static void StopTrinityServer()
 {
     CNativeNetwork.StopSocketServer();
 }