コード例 #1
0
 public static void InitNetwork()
 {
     Console.WriteLine("INIT Packets...");
     ServerHandleData.InitializePackets();
     serverSocket.Start();
     serverSocket.BeginAcceptTcpClient(new AsyncCallback(OnClientConnect), null);
 }
コード例 #2
0
ファイル: ServerTCP.cs プロジェクト: vedatermis/GameServer
 public static void InitializeNetwork()
 {
     Yazi.Log_yaz("Paketleriniz Başlatılıyor");
     ServerHandleData.InitializePackets();
     serverSocket.Start();
     serverSocket.BeginAcceptTcpClient(new AsyncCallback(OnClientConnet), null);
 }
コード例 #3
0
        private static void SetupServer()
        {
            for (int i = 0; i < Constants.MAX_PLAYERS; i++)
            {
                Types.TempPlayer[i] = new Types.TempPlayerRec();
            }

            ServerHandleData.InitMessages();
            NetworkSocket.Instance.ServerStart();
            MySql.MySqlInit();
            Database.InitializeCardDatabase();
        }
コード例 #4
0
        private void OnReceiveData(IAsyncResult result)
        {
            try
            {
                int length = stream.EndRead(result);
                if (length <= 0)
                {
                    CloseConnection();
                    return;
                }

                byte[] newBytes = new byte[length];
                Array.Copy(recBuffer, newBytes, length);
                ServerHandleData.HandleData(connectionID, newBytes);
                stream.BeginRead(recBuffer, 0, socket.ReceiveBufferSize, OnReceiveData, null);
            }
            catch (Exception) {
                CloseConnection();
                return;
            }
        }