Exemple #1
0
        public async void Start()
        {
            lock (this)
            {
                Running.CheckIfFulfills("Server", "running", false);
                Running = true;
            }

            socketListeners = new List <StreamSocketListener>();
            StreamSocketListener listener;

            foreach (HostName candidate in NetworkInformation.GetHostNames())
            {
                if (candidate.Type == HostNameType.Ipv4 || candidate.Type == HostNameType.Ipv6)
                {
                    listener = new StreamSocketListener();
                    listener.ConnectionReceived += OnConnectionReceived;

                    await listener.BindEndpointAsync(candidate, Port.ToString());

                    socketListeners.Add(listener);
                }
            }
        }