public void propagateNewMasterNode(String masterid, String masteraddress)
        {
            // TODO Auto-generated method stub
            NetworkBean data = new NetworkBean();

            //ServerOperations serveroperation = new ServerOperations();

            foreach (KeyValuePair <string, string> entry in data.getpId_Address())
            {
                String sendAddress = entry.Value;

                try
                {
                    setMasterAddrId proxy = XmlRpcProxyGen.Create <setMasterAddrId>();
                    proxy.Url = sendAddress;
                    proxy.setMasterAddressId(masterid, masteraddress);
                    Console.WriteLine("sending message I am New Master to :" + sendAddress);
                }
                catch (Exception e)
                {
                    // TODO Auto-generated catch block
                    Console.WriteLine("Could not send the message succesfully.. node denied connection");
                    // Console.WriteLine(e.StackTrace);
                }
            }
        }
 public void setMasterNode(String address)
 {
     try
     {
         NetworkBean      data             = new NetworkBean();
         ServerOperations serveroperaation = new ServerOperations();
         setMasterAddrId  proxy            = XmlRpcProxyGen.Create <setMasterAddrId>();
         proxy.Url = address;
         proxy.setMasterAddressId(data.getMasterPid(), data.getMasterAddress());
     }
     catch (Exception e)
     {
         Console.WriteLine(e.StackTrace);
     }
 }
        public void signOff()
        {
            NetworkBean data = new NetworkBean();


            foreach (KeyValuePair <string, string> entry in data.getpId_Address())
            {
                String sendAddress = entry.Value;
                String iD          = entry.Key;

                try
                {
                    nodeSignoff proxy = XmlRpcProxyGen.Create <nodeSignoff>();
                    proxy.Url = sendAddress;
                    proxy.nodeSignOff(data.getpId());
                    Console.WriteLine("sending message Signing off to :" + sendAddress);
                }
                catch (Exception e)
                {
                    // TODO Auto-generated catch block
                    Console.WriteLine("Could not send the message succesfully.. node denied connection");
                    removeNode(iD);
                    //  Console.WriteLine(e.StackTrace);
                }
            }


            if (data.getMasterPid().Equals(data.getpId()))
            {
                foreach (KeyValuePair <string, string> entry in data.getpId_Address())
                {
                    addr = entry.Value;
                    ide  = entry.Key;
                }

                foreach (KeyValuePair <string, string> entry in data.getpId_Address())
                {
                    try
                    {
                        // NetworkBean data = new NetworkBean();
                        ServerOperations serveroperaation = new ServerOperations();
                        setMasterAddrId  proxy            = XmlRpcProxyGen.Create <setMasterAddrId>();
                        proxy.Url = entry.Value;
                        proxy.setMasterAddressId(ide, addr);
                    }
                    catch (Exception e)
                    {
                        //  Console.WriteLine(e.StackTrace);
                    }
                }



                String response = "";
                foreach (KeyValuePair <string, string> entry in data.getpId_Address())
                {
                    String sendAddress = entry.Value;

                    try
                    {
                        callBullyAfterSignoff proxy = XmlRpcProxyGen.Create <callBullyAfterSignoff>();
                        proxy.Url = sendAddress;
                        response  = proxy.callBullyAfterSignOff(data.getpId());
                        Console.WriteLine(data.getpId() + "  Sends the bully election message to :" + sendAddress);
                        Console.WriteLine("response is :" + response);
                    }
                    catch (Exception e)
                    {
                        // TODO Auto-generated catch block
                        Console.WriteLine("no response");
                        //  Console.WriteLine(e.StackTrace);
                    }


                    if (response.Length > 0)
                    {
                        break;
                    }
                }
            }



            data.getpId_Address().Clear();
            data.setMasterAddress(data.getAddress());
            data.setMasterPid(data.getpId());
        }