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); }
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); }