Exemple #1
0
 /// <summary>
 /// Creates a new instance connected to the parent role server.
 /// </summary>
 /// <param name="RoleServer">Parent role server.</param>
 /// <param name="LogPrefix">Log prefix of the parent role server.</param>
 public ProxMessageProcessor(TcpRoleServer <IncomingClient> RoleServer, string LogPrefix = "")
 {
     roleServer      = RoleServer;
     logPrefix       = LogPrefix;
     log             = new Logger("ProximityServer.Network.ProxMessageProcessor", logPrefix);
     serverComponent = (Server)Base.ComponentDictionary[Server.ComponentName];
     clientList      = serverComponent.GetClientList();
 }
Exemple #2
0
        /// <summary>
        /// Creates the instance for a new TCP server client.
        /// </summary>
        /// <param name="Server">Role server that the client connected to.</param>
        /// <param name="TcpClient">TCP client class that holds the connection and allows communication with the client.</param>
        /// <param name="Id">Unique identifier of the client's connection.</param>
        /// <param name="UseTls">true if the client is connected to the TLS port, false otherwise.</param>
        /// <param name="KeepAliveIntervalMs">Number of seconds for the connection to this client to be without any message until the proximity server can close it for inactivity.</param>
        /// <param name="LogPrefix">Prefix for log entries created by the client.</param>
        public IncomingClient(TcpRoleServer <IncomingClient> Server, TcpClient TcpClient, ulong Id, bool UseTls, int KeepAliveIntervalMs, string LogPrefix) :
            base(TcpClient, new ProxMessageProcessor(Server, LogPrefix), Id, UseTls, KeepAliveIntervalMs, Server.IdBase, Server.ShutdownSignaling, LogPrefix)
        {
            this.Id = Id;
            log     = new Logger("ProximityServer.Network.IncomingClient", LogPrefix);

            log.Trace("(UseTls:{0},KeepAliveIntervalMs:{1})", UseTls, KeepAliveIntervalMs);

            messageBuilder = new ProxMessageBuilder(Server.IdBase, new List <SemVer>()
            {
                SemVer.V100
            }, Config.Configuration.Keys);
            this.KeepAliveIntervalMs = KeepAliveIntervalMs;
            NextKeepAliveTime        = DateTime.UtcNow.AddMilliseconds(this.KeepAliveIntervalMs);

            ConversationStatus = ClientConversationStatus.NoConversation;

            log.Trace("(-)");
        }