Пример #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // 반복 처리를 위한 스레드(UI 동기)
            workProcessTimer.Tick    += new EventHandler(OnProcessTimedEvent);
            workProcessTimer.Interval = new TimeSpan(0, 0, 0, 0, 32);
            workProcessTimer.Start();

            Config = new CgsfNET64Lib.NetworkConfig()
            {
                IP             = "127.0.0.1",
                Port           = 25251,
                EngineDllName  = "CGSFNet.dll",
                MaxAcceptCount = 1000,
                ThreadCount    = 4,
                ProtocolOption = 0,
                ProtocolID     = 0,
                MaxBufferSize  = 16000,
                MaxPacketSize  = 4012,
            };

            var result = ServerNet.Init(Config, null, null);

            if (result == CgsfNET64Lib.NET_ERROR_CODE_N.SUCCESS)
            {
                DevLog.Write(string.Format("[Init] IP:{0}, Port:{1}, EngineDllName:{2}", Config.IP, Config.Port, Config.EngineDllName), LOG_LEVEL.INFO);
            }
            else
            {
                DevLog.Write(string.Format("[Init] 네트워크 라이브러리 초기화 실패. {0}, {1}", result.ToString(), result), LOG_LEVEL.ERROR);
            }
        }
        private void MainForm_Load(object sender, EventArgs e)
        {
            workProcessTimer.Tick    += new EventHandler(OnProcessTimedEvent);
            workProcessTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            workProcessTimer.Start();

            Config = new CgsfNET64Lib.NetworkConfig()
            {
                IP             = Properties.Settings.Default.IP,
                Port           = Properties.Settings.Default.Port,
                EngineDllName  = Properties.Settings.Default.EngineDllName,
                MaxAcceptCount = Properties.Settings.Default.MaxAcceptCount,
                ThreadCount    = Properties.Settings.Default.ThreadCount,
                ProtocolOption = 0,
                ProtocolID     = 0,
                MaxBufferSize  = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize  = Properties.Settings.Default.MaxPacketSize,
            };

            var ConnectInfoList = new List <CgsfNET64Lib.RemoteServerConnectInfo>();

            ConnectInfoList.Add(new CgsfNET64Lib.RemoteServerConnectInfo()
            {
                ConnectID      = GAMESERVER_CONNECT_ID,
                Description    = "GameServer",
                IP             = Properties.Settings.Default.GameServerIP,
                Port           = Properties.Settings.Default.GameServerPort,
                ProtocolOption = 0,
                ProtocolID     = 1,
                MaxBufferSize  = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize  = Properties.Settings.Default.MaxPacketSize,
            });


            var result = ServerNet.Init(Config, ConnectInfoList, null);

            if (result != CgsfNET64Lib.NET_ERROR_CODE_N.SUCCESS)
            {
                DevLog.Write(string.Format("[Init] 네트워크 라이브러리 초기화 실패. {0}, {1}", result.ToString(), result), LOG_LEVEL.ERROR);
                return;
            }

            IsStartServerNetwork = true;
            if (ServerNet.Start(Config.ProtocolID))
            {
                HandelrMgr.Create(ServerNet, Config.MaxAcceptCount);
                ConnectCountToGUI(0);

                DevLog.Write(string.Format("[Start] 네트워크 시작"), LOG_LEVEL.INFO);
            }
            else
            {
                IsStartServerNetwork = false;
                DevLog.Write(string.Format("[Start] 네트워크 시작 실패"), LOG_LEVEL.ERROR);
            }

            NetworkConfigInfoToGui();
        }
Пример #3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            workProcessTimer.Tick    += new EventHandler(OnProcessTimedEvent);
            workProcessTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            workProcessTimer.Start();

            Config = new CgsfNET64Lib.NetworkConfig()
            {
                IP             = Properties.Settings.Default.IP,
                Port           = Properties.Settings.Default.Port,
                EngineDllName  = Properties.Settings.Default.EngineDllName,
                MaxAcceptCount = Properties.Settings.Default.MaxAcceptCount,
                ThreadCount    = Properties.Settings.Default.ThreadCount,
                ProtocolOption = 0,
                ProtocolID     = 0,
                MaxBufferSize  = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize  = Properties.Settings.Default.MaxPacketSize,
            };

            MaxLobbyCount     = Properties.Settings.Default.MaxLobbyCount;
            MaxLobbyUserCount = Properties.Settings.Default.MaxLobbyUserCount;


            var result = ServerNet.Init(Config, null, null);

            if (result != CgsfNET64Lib.NET_ERROR_CODE_N.SUCCESS)
            {
                DevLog.Write(string.Format("[Init] 네트워크 라이브러리 초기화 실패. {0}, {1}", result.ToString(), result), LOG_LEVEL.ERROR);
                return;
            }

            IsStartServerNetwork = true;
            if (ServerNet.Start(Config.ProtocolID))
            {
                DevLog.Write(string.Format("[Start] 네트워크 시작"), LOG_LEVEL.INFO);
            }
            else
            {
                DevLog.Write(string.Format("[Start] 네트워크 시작 실패"), LOG_LEVEL.ERROR);
            }


            HandelrMgr.Create(ServerNet, MaxLobbyCount, MaxLobbyUserCount);


            SetGUIInfo();
            ConnectCountToGUI(0);
        }
Пример #4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            workProcessTimer.Tick += new EventHandler(OnProcessTimedEvent);
            workProcessTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            workProcessTimer.Start();

            Config = new CgsfNET64Lib.NetworkConfig()
            {
                IP = Properties.Settings.Default.IP,
                Port = Properties.Settings.Default.Port,
                EngineDllName = Properties.Settings.Default.EngineDllName,
                MaxAcceptCount = Properties.Settings.Default.MaxAcceptCount,
                ThreadCount = Properties.Settings.Default.ThreadCount,
                ProtocolOption = 0,
                ProtocolID = 0,
                MaxBufferSize = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize = Properties.Settings.Default.MaxPacketSize,
            };

            MaxLobbyCount = Properties.Settings.Default.MaxLobbyCount;
            MaxLobbyUserCount = Properties.Settings.Default.MaxLobbyUserCount;

            var result = ServerNet.Init(Config, null, null);
            if (result != CgsfNET64Lib.NET_ERROR_CODE_N.SUCCESS)
            {
                DevLog.Write(string.Format("[Init] 네트워크 라이브러리 초기화 실패. {0}, {1}", result.ToString(), result), LOG_LEVEL.ERROR);
                return;
            }

            IsStartServerNetwork = true;
            if (ServerNet.Start(Config.ProtocolID))
            {
                DevLog.Write(string.Format("[Start] 네트워크 시작"), LOG_LEVEL.INFO);
            }
            else
            {
                DevLog.Write(string.Format("[Start] 네트워크 시작 실패"), LOG_LEVEL.ERROR);
            }

            HandelrMgr.Create(ServerNet, MaxLobbyCount, MaxLobbyUserCount);

            SetGUIInfo();
            ConnectCountToGUI(0);
        }
Пример #5
0
        public Form1()
        {
            InitializeComponent();

            Config = new CgsfNET64Lib.NetworkConfig()
            {
                IP = "127.0.0.1",
                Port = 25251,
                EngineDllName = "CGSFNet.dll",
                MaxAcceptCount = 1000,
                ThreadCount = 4,
                ProtocolOption = 0,
                ProtocolID = 0,
                MaxBufferSize = 16000,
                MaxPacketSize = 4012,
            };

            var result = ServerNet.Init(Config, null, null);
            if (result == CgsfNET64Lib.NET_ERROR_CODE_N.SUCCESS)
            {
                DevLog.Write(string.Format("[Init] IP:{0}, Port:{1}, EngineDllName:{2}", Config.IP, Config.Port, Config.EngineDllName), LOG_LEVEL.INFO);

            }
            else
            {
                DevLog.Write(string.Format("[Init] 네트워크 라이브러리 초기화 실패. {0}, {1}", result.ToString(), result), LOG_LEVEL.ERROR);
            }

            bool resulta = ServerNet.AddTimer(1, 1000, 1000);
            ServerNet.Start(0);

            // 반복 처리를 위한 스레드(UI 동기)
            workProcessTimer.Tick += new EventHandler(OnProcessTimedEvent);
            workProcessTimer.Interval = new TimeSpan(0, 0, 0, 0, 32);
            workProcessTimer.Start();
        }
        private void MainForm_Load(object sender, EventArgs e)
        {
            workProcessTimer.Tick    += new EventHandler(OnProcessTimedEvent);
            workProcessTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            workProcessTimer.Start();

            Config = new CgsfNET64Lib.NetworkConfig()
            {
                IP             = Properties.Settings.Default.IP,
                Port           = 0,
                EngineDllName  = Properties.Settings.Default.EngineDllName,
                MaxAcceptCount = Properties.Settings.Default.MaxAcceptCount,
                ThreadCount    = Properties.Settings.Default.ThreadCount,
                ProtocolOption = 0,
                ProtocolID     = 0,
                MaxBufferSize  = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize  = Properties.Settings.Default.MaxPacketSize,
            };

            MultiListenInfo.Add(new CgsfNET64Lib.MultiListenNetworkInfo()
            {
                ListenID       = 0,
                MaxBufferSize  = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize  = Properties.Settings.Default.MaxPacketSize,
                Port           = 25252,
                ProtocolID     = 1,
                ProtocolOption = 0
            });
            MultiListenInfo.Add(new CgsfNET64Lib.MultiListenNetworkInfo()
            {
                ListenID       = 0,
                MaxBufferSize  = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize  = Properties.Settings.Default.MaxPacketSize,
                Port           = 25253,
                ProtocolID     = 2,
                ProtocolOption = 0
            });


            try
            {
                var result = ServerNet.Init(Config, null, MultiListenInfo);
                if (result != CgsfNET64Lib.NET_ERROR_CODE_N.SUCCESS)
                {
                    DevLog.Write(string.Format("[Init] 네트워크 라이브러리 초기화 실패. {0}, {1}", result.ToString(), result), LOG_LEVEL.ERROR);
                    return;
                }
            }
            catch (Exception ex)
            {
                DevLog.Write(string.Format("[Init] 예외 발생. {0}", ex.ToString()), LOG_LEVEL.ERROR);
            }


            IsStartServerNetwork = true;
            if (ServerNet.Start(-1))
            {
                HandelrMgr.Create(ServerNet, Config.MaxAcceptCount);
                ConnectCountToGUI(0);

                DevLog.Write(string.Format("[Start] 네트워크 시작"), LOG_LEVEL.INFO);
            }
            else
            {
                IsStartServerNetwork = false;
                DevLog.Write(string.Format("[Start] 네트워크 시작 실패"), LOG_LEVEL.ERROR);
            }

            NetworkConfigInfoToGui();
        }
Пример #7
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            workProcessTimer.Tick += new EventHandler(OnProcessTimedEvent);
            workProcessTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            workProcessTimer.Start();

            Config = new CgsfNET64Lib.NetworkConfig()
            {
                IP = Properties.Settings.Default.IP,
                Port = 0,
                EngineDllName = Properties.Settings.Default.EngineDllName,
                MaxAcceptCount = Properties.Settings.Default.MaxAcceptCount,
                ThreadCount = Properties.Settings.Default.ThreadCount,
                ProtocolOption = 0,
                ProtocolID = 0,
                MaxBufferSize = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize = Properties.Settings.Default.MaxPacketSize,
            };

            MultiListenInfo.Add(new CgsfNET64Lib.MultiListenNetworkInfo()
            {
                ListenID = 0,
                MaxBufferSize = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize = Properties.Settings.Default.MaxPacketSize,
                Port = 25252,
                ProtocolID = 1,
                ProtocolOption = 0 });
            MultiListenInfo.Add(new CgsfNET64Lib.MultiListenNetworkInfo()
            {
                ListenID = 0,
                MaxBufferSize = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize = Properties.Settings.Default.MaxPacketSize,
                Port = 25253,
                ProtocolID = 2,
                ProtocolOption = 0
            });

            try
            {
                var result = ServerNet.Init(Config, null, MultiListenInfo);
                if (result != CgsfNET64Lib.NET_ERROR_CODE_N.SUCCESS)
                {
                    DevLog.Write(string.Format("[Init] 네트워크 라이브러리 초기화 실패. {0}, {1}", result.ToString(), result), LOG_LEVEL.ERROR);
                    return;
                }
            }
            catch (Exception ex)
            {
                DevLog.Write(string.Format("[Init] 예외 발생. {0}", ex.ToString()), LOG_LEVEL.ERROR);
            }

            IsStartServerNetwork = true;
            if (ServerNet.Start(-1))
            {
                HandelrMgr.Create(ServerNet, Config.MaxAcceptCount);
                ConnectCountToGUI(0);

                DevLog.Write(string.Format("[Start] 네트워크 시작"), LOG_LEVEL.INFO);
            }
            else
            {
                IsStartServerNetwork = false;
                DevLog.Write(string.Format("[Start] 네트워크 시작 실패"), LOG_LEVEL.ERROR);
            }

            NetworkConfigInfoToGui();
        }
Пример #8
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            workProcessTimer.Tick += new EventHandler(OnProcessTimedEvent);
            workProcessTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            workProcessTimer.Start();

            Config = new CgsfNET64Lib.NetworkConfig()
            {
                IP = Properties.Settings.Default.IP,
                Port = Properties.Settings.Default.Port,
                EngineDllName = Properties.Settings.Default.EngineDllName,
                MaxAcceptCount = Properties.Settings.Default.MaxAcceptCount,
                ThreadCount = Properties.Settings.Default.ThreadCount,
                ProtocolOption = 0,
                ProtocolID = 0,
                MaxBufferSize = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize = Properties.Settings.Default.MaxPacketSize,
            };

            var ConnectInfoList = new List<CgsfNET64Lib.RemoteServerConnectInfo>();
            ConnectInfoList.Add(new CgsfNET64Lib.RemoteServerConnectInfo()
            {
                ConnectID = GAMESERVER_CONNECT_ID,
                Description = "GameServer",
                IP = Properties.Settings.Default.GameServerIP,
                Port = Properties.Settings.Default.GameServerPort,
                ProtocolOption = 0,
                ProtocolID = 1,
                MaxBufferSize = Properties.Settings.Default.MaxBufferSize,
                MaxPacketSize = Properties.Settings.Default.MaxPacketSize,

            });

            var result = ServerNet.Init(Config, ConnectInfoList, null);
            if (result != CgsfNET64Lib.NET_ERROR_CODE_N.SUCCESS)
            {
                DevLog.Write(string.Format("[Init] 네트워크 라이브러리 초기화 실패. {0}, {1}", result.ToString(), result), LOG_LEVEL.ERROR);
                return;
            }

            IsStartServerNetwork = true;
            if (ServerNet.Start(Config.ProtocolID))
            {
                HandelrMgr.Create(ServerNet, Config.MaxAcceptCount);
                ConnectCountToGUI(0);

                DevLog.Write(string.Format("[Start] 네트워크 시작"), LOG_LEVEL.INFO);
            }
            else
            {
                IsStartServerNetwork = false;
                DevLog.Write(string.Format("[Start] 네트워크 시작 실패"), LOG_LEVEL.ERROR);
            }

            NetworkConfigInfoToGui();
        }