public String joinNetwork(String iD, String address) { NetworkBean data = new NetworkBean(); CsClient csclient = new CsClient(); Dictionary <String, String> returnAddressIdMap = new Dictionary <String, String>(); foreach (KeyValuePair <string, string> entry in data.getpId_Address()) { returnAddressIdMap.Add(entry.Key, entry.Value); } // call function to send the new address to all nodes try { csclient.addReturnAdressToList(address); csclient.propagateNewNodeAddress(returnAddressIdMap, iD, address); } catch (Exception e) { // TODO Auto-generated catch block Console.WriteLine(e.StackTrace); } returnAddressIdMap.Add(data.getpId(), data.getAddress()); data.addValuesToDictionary(iD, address); try { csclient.setMasterNode(address); } catch (Exception e) { // TODO Auto-generated catch block Console.WriteLine(e.StackTrace); } return(data.getpId()); }
public Boolean updateAddressMap(String iD, String address) { NetworkBean data = new NetworkBean(); data.addValuesToDictionary(iD, address); return(true); }
public void join(String sendAddress) { // NetworkBean data = new NetworkBean(); joinNetw proxy = XmlRpcProxyGen.Create <joinNetw>(); proxy.Url = sendAddress; try { String recievedId = proxy.joinNetwork(data.getpId(), data.getAddress()); data.addValuesToDictionary(recievedId, sendAddress); } catch (Exception e) { // TODO Auto-generated catch block Console.WriteLine(e.StackTrace); } }