Пример #1
0
        //程序入口
        static void Main(string[] args)
        {
            server.BinaryInput  = new BinaryInputHandler(BinaryInputHandler);   //设置输入代理
            server.Connetions   = new ConnectionFilter(ConnectionFilter);       //设置连接代理
            server.MessageInput = new MessageInputHandler(MessageInputHandler); //设置 客户端断开
            server.Start();                                                     //启动服务器

            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            server.BinaryInput  = new BinaryInputHandler(BinaryInputHandler);
            server.Connetions   = new ConnectionFilter(ConnectionFilter);
            server.MessageInput = new MessageInputHandler(MessageInputHandler);
            server.MessageOut  += new EventHandler <LogOutEventArgs>(server_MessageOut);
            server.Start();

            Console.ReadLine();
        }
Пример #3
0
        //程序入口
        static void Main(string[] args)
        {
            System.Threading.ExecutionContext.SuppressFlow();
            server.BinaryInput  = new BinaryInputHandler(BinaryInputHandler);   //设置输入代理
            server.Connetions   = new ConnectionFilter(ConnectionFilter);       //设置连接代理
            server.MessageInput = new MessageInputHandler(MessageInputHandler); //设置 客户端断开
            server.Start();                                                     //启动服务器

            Console.ReadLine();
        }
Пример #4
0
        //程序入口
        static void Main(string[] args)
        {
            ReadBytes.ObjFormatType  = BuffFormatType.protobuf;
            server.BinaryOffsetInput = new BinaryInputOffsetHandler(BinaryInputHandler); //设置输入代理
            server.Connetions        = new ConnectionFilter(ConnectionFilter);           //设置连接代理
            server.MessageInput      = new MessageInputHandler(MessageInputHandler);     //设置 客户端断开
            server.IsOffsetInput     = true;
            server.Start();                                                              //启动服务器

            Console.ReadLine();
        }
Пример #5
0
        static void Main(string[] args)
        {
            BufferFormatV2.ObjFormatType = BuffFormatType.XML;
            ReadBytesV2.ObjFormatType    = BuffFormatType.XML;


            server.BinaryInput  = new BinaryInputHandler(BinaryInputHandler);   //设置输入代理
            server.Connetions   = new ConnectionFilter(ConnectionFilter);       //设置连接代理
            server.MessageInput = new MessageInputHandler(MessageInputHandler); //设置 客户端断开
            server.Start();                                                     //启动服务器

            Console.ReadLine();
        }
Пример #6
0
        private void Server_Load(object sender, EventArgs e)
        {
            LoadingUser();

            BufferFormatV2.ObjFormatType = BuffFormatType.protobuf;
            ReadBytesV2.ObjFormatType    = BuffFormatType.protobuf;
            server.BinaryOffsetInput     = new BinaryInputOffsetHandler(BinaryInputHandler); //设置输入代理
            server.Connetions            = new ConnectionFilter(ConnectionFilter);           //设置连接代理
            server.MessageInput          = new MessageInputHandler(MessageInputHandler);     //设置 客户端断开
            server.IsOffsetInput         = true;
            server.Start();                                                                  //启动服务器

            this.WindowState = FormWindowState.Minimized;
        }
Пример #7
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!IsSTART)
     {
         server.Start();
         IsSTART           = true;
         this.button1.Text = "暂停";
     }
     else
     {
         server.Stop();
         IsSTART           = false;
         this.button1.Text = "开始";
     }
 }
Пример #8
0
        //程序入口
        static void Main(string[] args)
        {
            byte[] data = { 0xc4, 0xe3, 0xba, 0xc3 };

            string x = Encoding.Default.GetString(data);



            ReadBytes.ObjFormatType  = BuffFormatType.protobuf;
            server.BinaryOffsetInput = new BinaryInputOffsetHandler(BinaryInputHandler); //设置输入代理
            server.Connetions        = new ConnectionFilter(ConnectionFilter);           //设置连接代理
            server.MessageInput      = new MessageInputHandler(MessageInputHandler);     //设置 客户端断开
            server.IsOffsetInput     = true;
            server.Start();                                                              //启动服务器

            Console.ReadLine();
        }
Пример #9
0
        static void Main(string[] args)
        {
            MainServer              = new ZYSocketSuper(Config.Default.ServerIP, Config.Default.MServerPort, Config.Default.MaxConCount, 1024);
            MainServer.BinaryInput  = new BinaryInputHandler(MainDataIn);
            MainServer.Connetions   = new ConnectionFilter(MainConnetion);
            MainServer.MessageInput = new MessageInputHandler(MainExpection);

            IpServer              = new ZYSocketSuper(Config.Default.ServerIP, Config.Default.RegServerPort, Config.Default.MaxConCount, 1024);
            IpServer.BinaryInput  = new BinaryInputHandler(IpDataIn);
            IpServer.Connetions   = new ConnectionFilter(IpConnetion);
            IpServer.MessageInput = new MessageInputHandler(IpExpection);

            IpServer.Start();
            MainServer.Start();


            Console.ReadLine();
        }
Пример #10
0
        /// <summary>
        /// 启动
        /// </summary>
        public void Start()
        {
            if (IsRun)
            {
                LLOG("Service Is Start...", EventLogType.INFO);
                return;
            }

            BufferFormat.ObjFormatType = BuffFormatType.protobuf;
            ReadBytes.ObjFormatType    = BuffFormatType.protobuf;

            ServicePackHander.GetInstance().Loading();

            SessionDiy = new ConcurrentDictionary <long, ZYNetSession>();

            Service                   = new ZYSocketSuper(RConfig.ReadString("Host"), RConfig.ReadInt("ServicePort"), RConfig.ReadInt("MaxConnectCount"), 4096); //初始化
            Service.Connetions        = new ConnectionFilter(Service_Connection);                                                                                //注册连接回调
            Service.BinaryOffsetInput = new BinaryInputOffsetHandler(Service_BinaryInput);                                                                       //注册输入包输入回调
            Service.MessageInput      = new MessageInputHandler(Service_UserDisconnect);                                                                         //注册用户断开回调
            Service.IsOffsetInput     = true;

            RegService              = new ZYSocketSuper(RConfig.ReadString("Host"), RConfig.ReadInt("RegPort"), RConfig.ReadInt("MaxConnectCount"), 1024); //初始化注册端口
            RegService.Connetions   = new ConnectionFilter(RegServer_Connection);                                                                          //注册连接回调
            RegService.BinaryInput  = new BinaryInputHandler(RegServer_BinaryInput);                                                                       //注册输入包输入回调
            RegService.MessageInput = new MessageInputHandler(RegServer_UserDisconnect);                                                                   //注册用户断开回调

            Service.Start();
            RegService.Start();

            RegPort         = RConfig.ReadInt("RegPort");
            BufferMaxLength = RConfig.ReadInt("BufferLength");


            LLOG("Service StartIng...", EventLogType.INFO);



            IsRun = true;
        }