Exemple #1
0
 public SimpleDiscovery(Raw raw)
 {
     this.raw = raw;
     if (raw == null)
         throw new ArgumentNullException ("raw");
     raw.SetReceiveCallback (MessageReceived);
     req = new HTTPRequest ();
     req.Method = "NOTIFY";
     req.URI = "*";
     req.Version = "HTTP/1.1";
 }
 public SimpleDiscovery(Raw raw)
 {
     this.raw = raw;
     if (raw == null)
     {
         throw new ArgumentNullException("raw");
     }
     raw.SetReceiveCallback(MessageReceived);
     req         = new HTTPRequest();
     req.Method  = "NOTIFY";
     req.URI     = "*";
     req.Version = "HTTP/1.1";
 }
Exemple #3
0
 public CachedDiscoveryManager(short port)
 {
     Guid id = Guid.NewGuid ();
     Raw r = new Raw (port);
     SimpleDiscovery sd = new SimpleDiscovery (r);
     Dictionary<string, string> arguments = new Dictionary<string, string> ();
     arguments.Add ("ID", id.ToString ());
     arguments.Add ("HOST", System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties ().DomainName);
     arguments.Add ("PORT", port.ToString ());
     sd.DiscoverMessageReceived += (sender, e) => {
         Guid msgID = Guid.Parse (e.Request.Arguments ["ID"]);
         if (hosts.ContainsKey (msgID)) {
             lock (hosts)
                 hosts.Add (msgID, e.Request);
         } else {
             lock (hosts)
                 hosts [msgID].Arguments = e.Request.Arguments;
         }
     };
     sd.SetMessageInformation (arguments);
 }