Example #1
0
 public Tcp(TcpConfig tcpConfig) : base(tcpConfig.Server, tcpConfig.Port, tcpConfig.ReconnectInterval)
 {
     keepAliveConfig            = tcpConfig.KeepAlive;
     useTls                     = tcpConfig.Tls.Enabled;
     retrieveClientCertificates = tcpConfig.Tls.RetrieveClientCertificates;
     framing                    = tcpConfig.Framing;
 }
Example #2
0
 public Tcp(TcpConfig tcpConfig) : base(tcpConfig.Server, tcpConfig.Port)
 {
     neverConnected = true;
     recoveryTime = TimeSpan.FromMilliseconds(tcpConfig.ReconnectInterval);
     useTls = tcpConfig.UseTls;
     framing = tcpConfig.Framing;
     dataChunkSize = tcpConfig.DataChunkSize;
 }
Example #3
0
 public Tcp(TcpConfig tcpConfig) : base(tcpConfig.Server, tcpConfig.Port, tcpConfig.ReconnectInterval)
 {
     this.remoteCertificateValidationCallback = tcpConfig.RemoteCertificateValidationCallback;
     keepAliveConfig            = tcpConfig.KeepAlive;
     useTls                     = tcpConfig.Tls.Enabled;
     retrieveClientCertificates = tcpConfig.Tls.RetrieveClientCertificates;
     framing                    = tcpConfig.Framing;
 }
Example #4
0
 public Tcp(TcpConfig tcpConfig) : base(tcpConfig.Server, tcpConfig.Port, tcpConfig.ReconnectInterval)
 {
     connectionCheckTimeout = tcpConfig.ConnectionCheckTimeout;
     keepAliveConfig        = tcpConfig.KeepAlive;
     useTls = tcpConfig.Tls.Enabled;
     retrieveClientCertificates = tcpConfig.Tls.RetrieveClientCertificates;
     framing       = tcpConfig.Framing;
     dataChunkSize = tcpConfig.DataChunkSize;
 }
Example #5
0
 public Tcp(TcpConfig tcpConfig) : base(tcpConfig.Server, tcpConfig.Port)
 {
     neverConnected         = true;
     recoveryTime           = TimeSpan.FromMilliseconds(tcpConfig.ReconnectInterval);
     keepAlive              = new KeepAlive(tcpConfig.KeepAlive);
     connectionCheckTimeout = tcpConfig.ConnectionCheckTimeout;
     useTls = tcpConfig.Tls.Enabled;
     retrieveClientCertificates = tcpConfig.Tls.RetrieveClientCertificates;
     framing       = tcpConfig.Framing;
     dataChunkSize = tcpConfig.DataChunkSize;
 }
        public bool IsValid(string message, FramingMethod? framing)
        {
            if (framing == null)
                return false;

            if (framing == FramingMethod.NonTransparent)
                return true;

            var splitted = Regex.Split(message, "(\\d{1,11}) (.*)").Where(x => x != string.Empty).ToArray();
            var octetCount = splitted[0];
            var octets = splitted.Length < 2 ? null : encoding.GetBytes(splitted[1]);
            return octetCount == octets?.Length.ToString();
        }
Example #7
0
 /// <summary>Builds a new instance of the TcpProtocolConfig class</summary>
 public TcpConfig()
 {
     server                     = Localhost;
     port                       = DefaultPort;
     recoveryTime               = TimeSpan.FromMilliseconds(DefaultReconnectInterval);
     keepAlive                  = new KeepAliveConfig();
     keepAlivePropsChanged      = (sender, args) => OnPropertyChanged(nameof(KeepAlive));
     keepAlive.PropertyChanged += keepAlivePropsChanged;
     connectionCheckTimeout     = DefaultConnectionCheckTimeout;
     Tls                  = new TlsConfig();
     tlsPropsChanged      = (sender, args) => OnPropertyChanged(nameof(KeepAlive));
     tls.PropertyChanged += tlsPropsChanged;
     framing              = FramingMethod.OctetCounting;
     dataChunkSize        = DefaultBufferSize;
 }
 public static ServerMsgSet FromStringAndFraming(string s, FramingMethod? framing)
 {
     var msgSet = new ServerMsgSet();
     switch (framing)
     {
         case FramingMethod.NonTransparent:
         {
             return FromStringNonTransparent(s, msgSet);
         }
         case FramingMethod.OctetCounting:
         {
             return FromStringOctetCounting(s, msgSet);
         }
         default:
         {
             return null;
         }
     }
 }