Exemplo n.º 1
0
        public Sockets(int Port, bool isSecure, bool isLocal)
        {
            Keys    = new SafeDict <List <string> >();
            Clients = new SafeDict <Connection>();

            iServer             = new Listener();
            iServer.Connection += Connected;

            iServer.Listen(Port, isSecure, isLocal);
        }
Exemplo n.º 2
0
        public void Close(string Reason)
        {
            if (isClosed)
            {
                return;
            }

            isClosed = true;

            foreach (Connection Ctx in Clients) // Client first
            {
                Remove(Ctx, "Server is closing: " + Reason, false);
            }

            Keys.Clear();
            Clients.Clear();

            Keys    = null;
            Clients = null;

            iServer.Close(Reason);
        }