Ejemplo n.º 1
0
        /// <summary>
        /// Начинает прослшку конкретного узла
        /// </summary>
        public static void StartListening(IPEndPoint localEndPoint, out AsynchronousServer listener)
        {
            try
            {
                listener = ListenerClientMap.Keys.FirstOrDefault(l =>
                                                                 ((IPEndPoint)l._socket.LocalEndPoint).Equals(localEndPoint));
                if (listener != null)
                {
                    Debug.Log($"Listener of {localEndPoint} is already opened");
                    return;
                }

                listener = new AsynchronousServer(localEndPoint);
                listener._socket.Bind(localEndPoint);
                listener._socket.Listen(Params.SERVER_CONNECTIONS_COUNT);
                ListenerClientMap.Add(listener, new List <AsynchronousClient>());

                ThreadManager.AsyncExecute(listener.AcceptClients, null);
            }
            catch (Exception e)
            {
                listener = null;
                Debug.Log(e);
            }
        }
Ejemplo n.º 2
0
        public void OnStart()
        {
            SetSubscription();

            AsynchronousServer.StartListening(Params.WideFieldEndPoint, out _wideFieldServer);
        }