Пример #1
0
        public PacketProcess(FreeNet.NetworkService <FreeNet.DefaultMessageResolver> netService)
        {
            RefNetworkService   = netService;
            RefPacketDispatcher = netService.PacketDispatcher;

            ServerOpt = netService.ServerOpt;
        }
Пример #2
0
        static void Main(string[] args)
        {
            var serverOpt = new FreeNet.ServerOption();

            serverOpt.MaxConnectionCount = 10000;
            serverOpt.ReceiveBufferSize  = 1024;

            var service = new FreeNet.NetworkService(serverOpt);

            service.Initialize();

            var socketOpt = new FreeNet.SocketOption();

            socketOpt.NoDelay = true;
            service.Listen("0.0.0.0", 7979, 100, socketOpt);

            Console.WriteLine("Started!");


            // 패킷 처리기 생성 및 실행
            var packetProcess = new PacketProcess(service);

            packetProcess.Start();


            while (true)
            {
                //Console.Write(".");
                string input = Console.ReadLine();

                if (input.Equals("users"))
                {
                    Console.WriteLine(service.UserManager.GetTotalCount());
                }
                else if (input.Equals("exit"))
                {
                    Console.WriteLine("Exit Process  !!!");

                    packetProcess.Stop();
                    service.Stop();

                    Console.WriteLine("Exit !!!");
                    break;
                }

                System.Threading.Thread.Sleep(500);
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            var serverOpt = new FreeNet.ServerOption();
            var service   = new FreeNet.NetworkService <FreeNet.DefaultMessageResolver>(serverOpt, null);

            service.Initialize();

            var socketOpt = new FreeNet.SocketOption();

            socketOpt.NoDelay = true;
            service.Listen("0.0.0.0", 7979, 100, socketOpt);

            Console.WriteLine("Started!");


            // 패킷 처리기 생성 및 실행
            var packetProcess = new PacketProcess(service);

            packetProcess.Start();


            while (true)
            {
                //Console.Write(".");
                string input = Console.ReadLine();

                if (input.Equals("users"))
                {
                    Console.WriteLine(service.SessionMgr.GetTotalCount());
                }
                else if (input.Equals("exit"))
                {
                    Console.WriteLine("Exit Process  !!!");

                    packetProcess.Stop();
                    service.Stop();

                    Console.WriteLine("Exit !!!");
                    break;
                }

                System.Threading.Thread.Sleep(500);
            }
        }
        static void Main(string[] args)
        {
            // IoThreadPacketDispatcher 에서 바로 패킷을 처리한다. 즉 멀티스레드로 패킷을 처리한다.
            var packetDispatcher = new IoThreadPacketDispatcher();


            var serverOpt = new FreeNet.ServerOption();

            var service = new FreeNet.NetworkService <FreeNet.DefaultMessageResolver>(serverOpt);

            service.Initialize();

            var socketOpt = new FreeNet.SocketOption();

            socketOpt.NoDelay = true;

            service.Listen("0.0.0.0", 7979, 100, socketOpt);

            Console.WriteLine("Started!");


            while (true)
            {
                //Console.Write(".");
                string input = Console.ReadLine();

                if (input.Equals("users"))
                {
                    Console.WriteLine(service.SessionMgr.GetTotalCount());
                }
                else if (input.Equals("Exit Process"))
                {
                    service.Stop();

                    Console.WriteLine("Exit !!!");
                    break;
                }

                System.Threading.Thread.Sleep(500);
            }
        }
Пример #5
0
 public PacketProcess(FreeNet.NetworkService netService)
 {
     RefNetworkService   = netService;
     RefPacketDispatcher = netService.PacketDispatcher;
 }