/// <summary>
        /// Initializes a new instance of the <see cref="UPnP_Device.UDP.UDPServer"/> class.
        /// </summary>
        /// <param name='ipconf'>
        /// ipconf is the configuration package containing information about the network util.
        /// </param>
        /// <param name='upnpconf'>
        /// Upnpconf contains information about the UPnP device
        /// </param>
        public UDPServer(IIpConfig ipconf, IUPnPConfig upnpconf)
        {
            sender = new MulticastSender(ipconf, upnpconf);          //Creates sender
            receiver = new MulticastReceiver();
            //receiver = new MulticastReceiver(IpConf, upnpconf);     //Creates receiver

            NotifyThread = new Thread(sender.NotifySender);     //Thread for notifier. Runs every _cacheexpire seconds
            ReceiveThread = new Thread(Run);                    //Run thread. The default UDP Thread

            _ip = ipconf;
            _upnPConfig = upnpconf;
            hand = new UDPHandler(sender, _upnPConfig);
        }
Ejemplo n.º 2
0
        public UPnP(IUPnPConfigPackage config)
        {
            IpConf = config.IpConf;
            UpnpConf = config.UpnpConf;
            XmlWriter = config.XmlWr;

            XmlWriter.GenDeviceDescription(UpnpConf);

            XMLServicesConfig ServiceConf = new XMLServicesConfig(config.ServiceConfPaths);

            TCPServer = new TcpServer(IpConf.IP, IpConf.TCPPort);
            UDPServer = new UDPHandler(IpConf, UpnpConf);
            UDPServer.Start();

            SubscribeToUpnpEvents();
        }