public static void StartTrinityServer(UInt16 port) { if (CNativeNetwork.StartSocketServer(port) == -1) { throw new System.Net.Sockets.SocketException(); } }
public static void StartTrinityServer(UInt16 port) { // config thread pool int cpu_core_count = Environment.ProcessorCount; CNativeNetwork.StartSocketServer(port); StartWorkerThreadPool(); }
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"); } }
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(); }
public static void StopTrinityServer() { CNativeNetwork.StopSocketServer(); }