Beispiel #1
0
        static void SetupServer()
        {
            MySQL.MySQLInit();

            for (int i = 0; i < Constants.MAX_PLAYER; i++)
            {
                ServerTCP.Clients[i] = new Client();
                Types.TempPlayer[i]  = new Types.TempPlayerRec();
            }
            ServerHandleData.InitMessages();
            ServerTCP.InitNetwork();
        }
Beispiel #2
0
 private void OnReceiveData(IAsyncResult ar)
 {
     // Console.WriteLine("abc");
     try
     {
         int readbytes = myStream.EndRead(ar);
         if (readbytes <= 0)
         {
             //Console.WriteLine("NOO");
             CloseSocket("1");
             return;
         }
         byte[] newBytes = new byte[readbytes];
         Buffer.BlockCopy(readBuff, 0, newBytes, 0, readbytes);
         ServerHandleData.HandleData(index, newBytes);
         myStream.BeginRead(readBuff, 0, socket.ReceiveBufferSize, OnReceiveData, null);
     }
     catch
     {
         CloseSocket("2");
         return;
     }
 }