private void OnConnect(IAsyncResult ar)
        {
            try
            {
                clientSocket.EndConnect(ar);

                //We are connected so we login into the server
                string l_fhName;
                string l_fhPass;
                Data   msgToSend = new Data();
                msgToSend.cmdCommand = Command.Login;

                //Username
                getNameDelegate fhName = new getNameDelegate(getLoginName);
                l_fhName = (string)this.UserNameTextBox.Dispatcher.Invoke(fhName, null);

                //Pass
                getPassDelegate fhPass = new getPassDelegate(getLoginPass);
                l_fhPass = (string)this.UserNameTextBox.Dispatcher.Invoke(fhPass, null);

                //Data set
                msgToSend.strName    = l_fhName;
                msgToSend.strMessage = l_fhPass;
                msgToSend.strRec     = Data.PUBLIC_ID;

                byte[] b = msgToSend.ToByte();

                //Send the message to the server
                clientSocket.BeginSend(b, 0, b.Length, SocketFlags.None, new AsyncCallback(OnSend), null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "SGSclient");
            }
        }
        private void OnReceive(IAsyncResult ar)
        {
            clientSocket.EndReceive(ar);

            //Transform the array of bytes received from the user into an
            //intelligent form of object Data
            Data msgReceived = new Data(_byteData);

            //Csak a nekem szóló üzenet kell. Ez akkor szükésges, ha I SOCKETEN TÖBB KAPCSOLAT IS VAN - Ez az 1 port per IP miatt lehet probléma, 1 gépes bemutatás esetén.
            string          local_fhNev;
            getNameDelegate fhNev = new getNameDelegate(getLoginName);

            local_fhNev = (string)this.UserNameTextBox.Dispatcher.Invoke(fhNev, null);
            if (msgReceived.strName.Equals(local_fhNev))
            {
                //Ha tudok csatlakozni
                if (msgReceived.cmdCommand == Command.Accept)
                {
                    new Thread(() =>
                    {
                        MessageBox.Show("Sikeres kapcsolódás!", "SGSclient connect");
                    }).Start();

                    UjFormDelegate pForm = new UjFormDelegate(UjForm);
                    this.Dispatcher.Invoke(pForm, null);
                }
                //Ha nem tudok csatlakozni
                else
                {
                    new Thread(() =>
                    {
                        MessageBox.Show("Kapcsolat megtagadva!", "SGSclient connect");
                    }).Start();
                }
            }
        }