示例#1
0
        public Client(Guid userId, int clientPort, IPEndPoint stanServerIP, int refreshInterval, SynchronizationContext ctx)
        {
            _selfId         = userId;
            _stanIP         = stanServerIP;
            _refreshMs      = refreshInterval;
            _clientPort     = clientPort;
            userObserver    = new UserObserver();
            messageObserver = new MessageObserver(_selfId);
            var blackHole = new UndefinedResolver();
            var routes    = userObserver.Compose(messageObserver, blackHole);

            observer = new UDPObserver(_clientPort, ctx, routes);
        }
示例#2
0
        public StunServer(int refreshInterval, SynchronizationContext ctx)
        {
            _synchronization = ctx;
            _refreshMs       = refreshInterval;
            var blackHole = new UndefinedResolver();

            userResolver = new UsersOnline();
            authresolver = new Authentification();

            var routes = authresolver.Compose(userResolver, blackHole);

            observer = new UDPObserver(_serverPort, ctx, routes);
            _client  = new UdpClient(AddressFamily.InterNetwork);
        }