private void cmdDisconnect_Click(object sender, EventArgs e)//If user wants to disconnect their team
        {
            byte[] buffer     = new byte[1024];
            string teamName   = txtTeamName.Text;
            string teamID     = txtTeamID.Text;
            string message    = MessageBuilder.unRegisterTeam(teamName, teamID);//Disconnecting unregisters team
            string ipString   = txtRegistryIP.Text;
            string portString = txtRegistryPort.Text;

            string[]       response = null;
            bool           isOK     = false;
            frmConnectTeam frm      = new frmConnectTeam();//Begin building form for reconnection
            IPAddress      ip       = IPAddress.Parse(ipString);
            int            port     = int.Parse(portString);
            Socket         regSock  = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);//Create socket for the registry

            //Try to unregister team
            try
            {
                regSock.Connect(ip, port);//Connect to registry
                Logging.LogLine("Calling SOA-Registry with message :");
                Logging.LogLine("\t" + message);
                TCPHelper.sendMessage(message, regSock);                        //Send the disconnect messge
                string respMessage = TCPHelper.receiveMessage(buffer, regSock); //Wait for response
                Logging.LogLine("\tResponse from SOA-Registry:");
                Logging.LogLine("\t\t" + respMessage);
                Logging.LogLine("---");

                response = MessageParser.parseMessage(respMessage);//Parse response by |
                //Was the response OK?
                isOK = MessageParser.checkOK(response[1]);
                if (isOK == true)
                {
                    //Close current form and open new form
                    this.Hide();
                    frm.Show();
                    regSock.Disconnect(true);
                }
                else if (isOK == false)
                {
                    MessageBox.Show("ERROR CODE: " + response[2] + "\n" + response[3]);
                    regSock.Disconnect(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void cmdDisconnectTeam_Click(object sender, EventArgs e)
        {
            byte[] buffer     = new byte[1024];
            string teamName   = txtTeamName.Text;
            string teamID     = txtTeamID.Text;
            string message    = MessageBuilder.unRegisterTeam(teamName, teamID);
            string ipString   = txtRegIP.Text;
            string portString = txtRegPort.Text;

            string[]       response = null;
            bool           isOK     = false;
            frmConnectTeam frm      = new frmConnectTeam();
            IPAddress      ip       = IPAddress.Parse(ipString);
            int            port     = int.Parse(portString);
            Socket         regSock  = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

            try
            {
                regSock.Connect(ip, port);
                Logging.LogLine("Calling SOA-Registry with message :");
                Logging.LogLine("\t" + message);
                TCPHelper.sendMessage(message, regSock);
                string respMessage = TCPHelper.receiveMessage(buffer, regSock);
                Logging.LogLine("\tResponse from SOA-Registry:");
                Logging.LogLine("\t\t" + respMessage);
                Logging.LogLine("---");
                response = MessageParser.parseMessage(respMessage);
                isOK     = MessageParser.checkOK(response[1]);
                if (isOK == true)
                {
                    frm.Show();
                    this.Hide();
                    regSock.Disconnect(true);
                }
                else if (isOK == false)
                {
                    MessageBox.Show("ERROR CODE: " + response[2] + "\n" + response[3]);
                    regSock.Disconnect(true);
                }
            }
            catch
            {
            }
        }