Esempio n. 1
0
        void btnLogin_OnPress(object sender, EventArgs e)
        {
            if (wait != 0)
            {
                return;
            }

            LoginData data;

            data.Name = new char[21];
            char[] temp = namebox.text.ToCharArray();
            for (int i = 0; i < temp.Length; i++)
            {
                data.Name[i] = temp[i];
            }


            data.Password = new char[21];
            temp          = passbox.text.ToCharArray();
            for (int i = 0; i < temp.Length; i++)
            {
                data.Password[i] = temp[i];
            }
            stPkgHead    head   = new stPkgHead();
            MemoryStream Stream = new MemoryStream();

            Stream.Write(SocketMgr.StructToBytes(data), 0, LoginData.size);
            head.dataSize = (int)Stream.Length;
            head.iSytle   = 10;

            SocketMgr.ConnectToServer();
            SocketMgr.StartReceiveThread();
            SocketMgr.SendCommonPackge(head, Stream);
            Stream.Close();

            wait++;
        }