public void ConsoleGroupSend()
        {
            Console.WriteLine ("Available groups:");
            foreach (string row in list_groups())
                Console.WriteLine ("\t" + row);
            Console.Write ("Destination group: ");
            string destGroup = Console.ReadLine ();
            Console.Write ("Content: ");
            string content = Console.ReadLine ();

            Message m = new Message ();
            m ["content"] = content;
            m ["type"] = "1";

            foreach (string item in list_machines(destGroup)) {
                Console.WriteLine ("Sending message to {0}...", item);
                network.talker (machines [item] ["address"],
                    int.Parse (machines [item] ["port"]),
                    m.ToString ());
            }
        }
 private void KeepAliveTrigger(object state)
 {
     Message m = new Message ();
     m ["content"] = "keep-alive";
     m ["type"] = "-1"; // Internal commands channel
     m ["myPort"] = listenPort.ToString(); //config ["client"] ["recipientPort"];
     m ["myAddress"] = address; // config ["client"] ["recipientAddress"];
     m ["subscription"] =  grp; //config ["client"] ["subscription"];
     network.talker (serverAddress, serverPort, m.ToString ());
 }
 public void unregisterOnServer()
 {
     if (this.serverAddress != "" && this.serverAddress != null) {
         Message m = new Message ();
         m ["content"] = "unregister";
         m ["type"] = "-1"; // Internal commands channel
         m ["myPort"] = this.listenPort.ToString(); //config ["client"] ["recipientPort"];
         m ["myAddress"] = this.address; // config ["client"] ["recipientAddress"];
         m ["subscription"] = this.grp; //config ["client"] ["subscription"];
         m["hostname"] = this.hostname;
         network.talker (this.serverAddress, this.serverPort, m.ToString ());
         this.serverAddress = null;
     }
 }
 public void registerOnServer()
 {
     Message m = new Message ();
     m ["content"] = "register";
     m ["type"] = "-1"; // Internal commands channel
     m ["myPort"] = listenPort.ToString();
     m ["myAddress"] = address;
             m["hostname"] = hostname = Dns.GetHostName();
     m ["subscription"] = grp; ///
     network.talker (this.serverAddress, this.serverPort, m.ToString ());
     TriggerKeepAlive ();
 }
示例#5
0
        private void sendMessage(string destination, int destinationPort, string message, string title, string icon)
        {
            monotifications.Message m = new monotifications.Message();
            m["content"] = message;
            m["type"] = icon;
            m["title"] = title;

            server.network.talker(destination, destinationPort, m.ToString());
        }
        public void ConsoleSingleSend()
        {
            string destIP;
            string port;
            string text;
            Console.Write ("Destination IP: ");
            destIP = Console.ReadLine ();
            Console.Write ("Destination port: ");
            port = Console.ReadLine ();
            Console.Write ("Content: ");
            text = Console.ReadLine ();

            Message m = new Message ();
            m ["content"] = text;
            m ["type"] = "1";

            network.talker (destIP, int.Parse (port), m.ToString ());
        }