public DistributedHTTester()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            chan = new GroupChannel(props);
            ht = new DistributedHashtable(chan,"testGroup", this);
            refreshOutput();
        }
 /// <summary>
 /// Constructor: Initialises/Connects channel and retreives current hashtable state.
 /// </summary>
 /// <param name="channel">The Channel to be used for sharing updates.</param>
 /// <param name="channelName">Name of channel to connect to.</param>
 /// <param name="listener">Object that will receive notification of updates.</param>
 public DistributedHashtable(Channel channel,string channelName, Listener listener)
     : base()
 {
     this.channel = channel;
     this.ad = new PullPushAdapter(channel, this);
     this.listener=listener;
     Console.WriteLine("About to connect to channel -->" + DateTime.Now.ToLongTimeString());
     channel.connect(channelName);
     Console.WriteLine("Connected -->" + DateTime.Now.ToLongTimeString());
     ad.start();
     if(channel.getView().size()>1)
         getState();
 }
Example #3
0
 public void channelDisconnected(Channel channel)
 {
     if (!closing)
         txtMsgsReceived.AppendText("-=-=-=-=-" + "Channel is Disconnected!" + "-=-=-=-=-" + "\n");
 }
Example #4
0
 // -=-=-=-=-=-=-=- ChannelListener Interface -=-=-=-=-=-=--=-
 public void channelConnected(Channel channel)
 {
     txtMsgsReceived.Clear();
     txtMsgsReceived.AppendText("-=-=-=-=-" + "Channel is Connected!" + "-=-=-=-=-" + "\n");
 }
Example #5
0
 private void disconnectChannel()
 {
     if(chan==null)
     {
         if(chkCausal.Checked)
             props += ":CAUSAL";
         chan = new GroupChannel(props);
         chan.setChannelListener(this);
         ad = new PullPushAdapter(chan, this, this);
     }
     if(!chan.isConnected())
     {
         if(String.Compare(txtGroupName.Text.Trim(),"")!=0)
         {
             chan.connect(txtGroupName.Text.Trim());
             ad.start();
         }
         else
         {
             MessageBox.Show(this,"text","caption",MessageBoxButtons.OK);
             return;
         }
         btnConnect.Text = "Disconnect";
         txtGroupName.Enabled = false;
         txtToSend.Enabled = true;
         txtHandle.Enabled = true;
         txtToSend.Text = "";
         btnSendMessage.Enabled = true;
         lstMembers.Enabled = true;
         txtMsgsReceived.Enabled = true;
         txtMsgsReceived.Text = "";
     }
     else
     {
         ad.stop();
         chan.disconnect();
         btnConnect.Text = "Connect";
         txtGroupName.Enabled = true;
         txtToSend.Enabled = false;
         btnSendMessage.Enabled = false;
         txtHandle.Enabled = false;
         lstMembers.Enabled = false;
         txtMsgsReceived.Enabled = false;
     }
 }
Example #6
0
 public void channelDisconnected(Channel channel)
 {
     Console.WriteLine("-=-=-=-=-" + "Channel is Disconnected!" + "-=-=-=-=-" + "\n");
 }
Example #7
0
 public void channelClosed(Channel channel)
 {
     Console.WriteLine("-=-=-=-=-" + "Channel is Closed!" + "-=-=-=-=-" + "\n");
 }
Example #8
0
 public Efficency()
 {
     chan = new GroupChannel(props);
     chan.setChannelListener(this);
 }