Ejemplo n.º 1
0
 /// <summary>
 /// Initialize called by the constructor that accepts a client config object. Can be called later to reset properties of client.
 /// </summary>
 /// <param name="clientConfigObject"></param>
 public void Initialize(TcpClientConfigObject clientConfigObject)
 {
     try
     {
         if (clientConfigObject != null)
         {
             var TcpSshProperties = clientConfigObject.Control.TcpSshProperties;
             Hostname                = TcpSshProperties.Address;
             AutoReconnect           = TcpSshProperties.AutoReconnect;
             AutoReconnectIntervalMs = TcpSshProperties.AutoReconnectIntervalMs > 1000 ?
                                       TcpSshProperties.AutoReconnectIntervalMs : 5000;
             SharedKey         = clientConfigObject.SharedKey;
             SharedKeyRequired = clientConfigObject.SharedKeyRequired;
             HeartbeatEnabled  = clientConfigObject.HeartbeatRequired;
             HeartbeatRequiredIntervalInSeconds = clientConfigObject.HeartbeatRequiredIntervalInSeconds > 0 ?
                                                  clientConfigObject.HeartbeatRequiredIntervalInSeconds : (ushort)15;
             HeartbeatString  = string.IsNullOrEmpty(clientConfigObject.HeartbeatStringToMatch) ? "heartbeat" : clientConfigObject.HeartbeatStringToMatch;
             Port             = TcpSshProperties.Port;
             BufferSize       = TcpSshProperties.BufferSize > 2000 ? TcpSshProperties.BufferSize : 2000;
             ReceiveQueueSize = clientConfigObject.ReceiveQueueSize > 20 ? clientConfigObject.ReceiveQueueSize : 20;
             MessageQueue     = new CrestronQueue <GenericTcpServerCommMethodReceiveTextArgs>(ReceiveQueueSize);
         }
         else
         {
             ErrorLog.Error("Could not initialize client with key: {0}", Key);
         }
     }
     catch
     {
         ErrorLog.Error("Could not initialize client with key: {0}", Key);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Contstructor that sets all properties by calling the initialize method with a config object.
 /// </summary>
 /// <param name="serverConfigObject"></param>
 public GenericSecureTcpIpClient_ForServer(string key, TcpClientConfigObject clientConfigObject)
     : base(key)
 {
     CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
     Initialize(clientConfigObject);
 }