Exemple #1
0
        private static void StartSsdp()
        {
            try {
                string BindAddress = Dns.GetHostName();

                IPAddress   ip  = null;
                IPAddress[] ips = Dns.GetHostAddresses(BindAddress);

                // Try to send an IPv4 address
                foreach (var i in ips)
                {
                    if (i.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                    {
                        ip = i;
                        break;
                    }
                }

                if (ip == null)
                {
                    ip = ips[0];
                }

                // Start the announce server
                ssdp_service = new Mono.Ssdp.Server();

                string location = string.Format("{0}|{1}|{2}|{3}|{4}", Dns.GetHostName(), ip.ToString(), port, Platform.GetPlatformString(), Platform.GetCapabilities());
                ssdp_service.Announce("mono-vs", Guid.NewGuid().ToString(), location);
            } catch {
                Logger.LogInfo("Could not start Ssdp, automatic server detection will be disabled.");
            }
        }
Exemple #2
0
 public Server (Root root, Uri url)
 {
     if (root == null) {
         throw new ArgumentNullException ("root");
     }
     
     this.root = root;
     
     if (url == null) {
         url = MakeUrl ();
     }
     
     var serializer = Helper.Get<XmlSerializer> (static_serializer);
     root.Initialize (serializer, url);
     // FIXME this is a test
     description_server = new DataServer (serializer.GetBytes (root), @"text/xml", url);
     ssdp_server = new SsdpServer (url.ToString ());
     ssdp_server.Announce ("upnp:rootdevice", root.RootDevice.Udn + "::upnp:rootdevice", false);
     AnnounceDevice (root.RootDevice);
 }
Exemple #3
0
        public Server(Root root, Uri url)
        {
            if (root == null)
            {
                throw new ArgumentNullException("root");
            }

            this.root = root;

            if (url == null)
            {
                url = MakeUrl();
            }

            var serializer = Helper.Get <XmlSerializer> (static_serializer);

            root.Initialize(serializer, url);
            // FIXME this is a test
            description_server = new DataServer(serializer.GetBytes(root), @"text/xml", url);
            ssdp_server        = new SsdpServer(url.ToString());
            ssdp_server.Announce("upnp:rootdevice", root.RootDevice.Udn + "::upnp:rootdevice", false);
            AnnounceDevice(root.RootDevice);
        }
Exemple #4
0
 private void Announce()
 {
     ssdp_server = new SsdpServer(description_server.Url.ToString());
     ssdp_server.Announce("upnp:rootdevice", root_device.Udn + "::upnp:rootdevice", false);
     AnnounceDevice(root_device);
 }
Exemple #5
0
 private void Announce()
 {
     ssdp_server = new SsdpServer (description_server.Url.ToString ());
     ssdp_server.Announce ("upnp:rootdevice", root_device.Udn + "::upnp:rootdevice", false);
     AnnounceDevice (root_device);
 }