Exemplo n.º 1
0
        public NodeDiscovery(ILoggerFactory logfac)
        {
            BindPort      = Definition.MulticastPort;
            TargetPort    = new[] { Definition.MulticastPort };
            loggerFactory = logfac;
            logger        = loggerFactory.CreateLogger("NodeDiscovery");

            timer              = new System.Threading.Timer(OnTimer, null, Timeout.Infinite, Timeout.Infinite);
            _SocketProxies     = new Dictionary <IPAddress, SsdpServerProxy>();
            udpMulticastServer = new UdpMulticastServer(loggerFactory.CreateLogger("UdpMulticastServer"));


            State     = NodeDiscoveryState.Created;
            TimeStamp = DateTime.UtcNow.ToFileTime();
        }
Exemplo n.º 2
0
        public SsdpServerProxy(IPAddress addr, int infindx, UdpMulticastServer svr, ILogger l, int bport, int[] tport)
        {
            BindPort   = bport;
            TargetPort = tport;

            address            = addr;
            interfaceIndex     = infindx;
            udpMulticastServer = svr;
            logger             = l;
            AnnounceString     = "";
            header             = new byte[] { 44, 59, 48, (byte)Definition.CloudVersion, 0, 0, 0, };
            responseCache      = new Dictionary <string, long>();
            searchCache        = new Dictionary <string, long>();

            //_Sendsocket = udpMulticastServer.CreateSocket(address, interfaceIndex, 0);
            sendsocket   = udpMulticastServer.CreateSocket(address, interfaceIndex, BindPort, address);
            listensocket = udpMulticastServer.CreateSocket(address, interfaceIndex, BindPort,
                                                           address.AddressFamily == AddressFamily.InterNetwork?IPAddress.Any:IPAddress.IPv6Any);
            BeginListeningForBroadcasts();
        }