Пример #1
0
 public void AddClient(QuarterClient Client)
 {
     Client.Id = ClientCount + "";
     ClientCount++;
     Clients.Add(Client);
     LatestClient = Client;
 }
Пример #2
0
 public void RemoveClient(QuarterClient Client)
 {
     Clients.Remove(Client);
     if (Client == LatestClient)
     {
         LatestClient = null;
     }
 }
Пример #3
0
        public QuarterServer(ServerConfig config)
        {
            DefaultAllow = config.DefaultAllow;
            Flags        = config.Flags;
            Host         = config.Host;
            Port         = config.Port;
            RSACrypto    = new RSACrypto();
            LatestClient = null;
            Clients      = new List <QuarterClient>();
            ClientCount  = 1;

            try
            {
                Listener = new TcpListener(Host, Port);
                Listener.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
                Listener.Start();
            } catch (Exception ex)
            {
                throw ex;
            }
        }