Esempio n. 1
0
 /// <summary>
 /// Transport security NetTcp binding constructor.
 /// </summary>
 /// <param name="endPointAddress">The endpoint address to connect to.</param>
 /// <param name="tcpClientCredentialType">The secure tcp client credential type</param>
 /// <param name="username">The UserName username</param>
 /// <param name="password">The UserName password</param>
 /// <param name="usernameWindows">The Windows ClientCredential username</param>
 /// <param name="passwordWindows">The Windows ClientCredential password</param>
 /// <param name="clientCertificate">The client x509 certificate.</param>
 /// <param name="validationMode">An enumeration that lists the ways of validating a certificate.</param>
 /// <param name="x509CertificateValidator">The certificate validator. If null then the certificate is always passed.</param>
 public TransferClient(string endPointAddress, System.ServiceModel.TcpClientCredentialType tcpClientCredentialType,
                       string username                                   = null, string password = null,
                       string usernameWindows                            = null, string passwordWindows = null,
                       X509Certificate2 clientCertificate                = null,
                       X509CertificateValidationMode validationMode      = X509CertificateValidationMode.Custom,
                       X509CertificateValidator x509CertificateValidator = null) :
     base(
         new Uri(endPointAddress),
         new System.ServiceModel.NetTcpBinding()
 {
     MaxReceivedMessageSize = Nequeo.Net.Properties.Settings.Default.TransferClientMaxReceivedMessageSize,
     MaxBufferSize          = (int)Nequeo.Net.Properties.Settings.Default.TransferClientMaxReceivedMessageSize,
     TransferMode           = System.ServiceModel.TransferMode.Buffered,
     Security = new System.ServiceModel.NetTcpSecurity()
     {
         Mode      = System.ServiceModel.SecurityMode.Transport,
         Transport = new System.ServiceModel.TcpTransportSecurity()
         {
             ClientCredentialType = tcpClientCredentialType
         }
     }
 }, username, password, usernameWindows, passwordWindows, clientCertificate, validationMode, x509CertificateValidator
         )
 {
     // Attach to the async execute complete
     // event handler.
     base.AsyncExecuteComplete += new Nequeo.Threading.EventHandler <object, bool, System.Exception>(TransferClient_AsyncExecuteComplete);
 }
Esempio n. 2
0
 /// <summary>
 /// Transport security NetTcp binding constructor.
 /// </summary>
 /// <param name="endPointAddress">The endpoint address to connect to.</param>
 /// <param name="tcpClientCredentialType">The secure tcp client credential type</param>
 /// <param name="username">The UserName username</param>
 /// <param name="password">The UserName password</param>
 /// <param name="usernameWindows">The Windows ClientCredential username</param>
 /// <param name="passwordWindows">The Windows ClientCredential password</param>
 /// <param name="clientCertificate">The client x509 certificate.</param>
 /// <param name="validationMode">An enumeration that lists the ways of validating a certificate.</param>
 /// <param name="x509CertificateValidator">The certificate validator. If null then the certificate is always passed.</param>
 public MessageClient(string endPointAddress, System.ServiceModel.TcpClientCredentialType tcpClientCredentialType,
                      string username                                   = null, string password = null,
                      string usernameWindows                            = null, string passwordWindows = null,
                      X509Certificate2 clientCertificate                = null,
                      X509CertificateValidationMode validationMode      = X509CertificateValidationMode.Custom,
                      X509CertificateValidator x509CertificateValidator = null) :
     base(
         new Uri(endPointAddress),
         new System.ServiceModel.NetTcpBinding()
 {
     MaxReceivedMessageSize = Nequeo.Net.Properties.Settings.Default.MessageClientMaxReceivedMessageSize,
     TransferMode           = System.ServiceModel.TransferMode.Buffered,
     MaxBufferPoolSize      = Nequeo.Net.Properties.Settings.Default.MessageClientMaxReceivedMessageSize,
     MaxBufferSize          = (int)Nequeo.Net.Properties.Settings.Default.MessageClientMaxReceivedMessageSize,
     ReaderQuotas           = new System.Xml.XmlDictionaryReaderQuotas()
     {
         MaxArrayLength         = (int)Nequeo.Net.Properties.Settings.Default.MessageClientMaxReceivedMessageSize,
         MaxBytesPerRead        = (int)Nequeo.Net.Properties.Settings.Default.MessageClientMaxReceivedMessageSize,
         MaxDepth               = (int)Nequeo.Net.Properties.Settings.Default.MessageClientMaxReceivedMessageSize,
         MaxNameTableCharCount  = (int)Nequeo.Net.Properties.Settings.Default.MessageClientMaxReceivedMessageSize,
         MaxStringContentLength = (int)Nequeo.Net.Properties.Settings.Default.MessageClientMaxReceivedMessageSize
     },
     Security = new System.ServiceModel.NetTcpSecurity()
     {
         Mode      = System.ServiceModel.SecurityMode.Transport,
         Transport = new System.ServiceModel.TcpTransportSecurity()
         {
             ClientCredentialType = tcpClientCredentialType
         }
     }
 }, username, password, usernameWindows, passwordWindows, clientCertificate, validationMode, x509CertificateValidator
         )
 {
     // Start the async control.
     _asyncAccount                = new Nequeo.Threading.AsyncExecutionHandler <MessageClient>();
     _asyncAccount.AsyncError    += new Threading.EventHandler <Exception>(_asyncAccount_AsyncError);
     _asyncAccount.AsyncComplete += new Threading.EventHandler <object, string>(_asyncAccount_AsyncComplete);
     _asyncAccount.InitiliseAsyncInstance(this);
 }
 /// <summary>
 /// Transport security NetTcp binding constructor.
 /// </summary>
 /// <param name="tcpClientCredentialType">The secure tcp client credential type</param>
 /// <param name="username">The UserName username</param>
 /// <param name="password">The UserName password</param>
 /// <param name="usernameWindows">The Windows ClientCredential username</param>
 /// <param name="passwordWindows">The Windows ClientCredential password</param>
 /// <param name="clientCertificate">The client x509 certificate.</param>
 /// <param name="validationMode">An enumeration that lists the ways of validating a certificate.</param>
 /// <param name="x509CertificateValidator">The certificate validator. If null then the certificate is always passed.</param>
 public TransferByteClient(System.ServiceModel.TcpClientCredentialType tcpClientCredentialType,
                           string username                                   = null, string password = null,
                           string usernameWindows                            = null, string passwordWindows = null,
                           X509Certificate2 clientCertificate                = null,
                           X509CertificateValidationMode validationMode      = X509CertificateValidationMode.Custom,
                           X509CertificateValidator x509CertificateValidator = null) :
     base(
         new Uri(Nequeo.Net.Properties.Settings.Default.TransferClientByteBaseAddress),
         new System.ServiceModel.NetTcpBinding()
 {
     MaxReceivedMessageSize = Nequeo.Net.Properties.Settings.Default.TransferClientByteMaxReceivedMessageSize,
     TransferMode           = System.ServiceModel.TransferMode.Buffered,
     MaxBufferPoolSize      = Nequeo.Net.Properties.Settings.Default.TransferClientByteMaxReceivedMessageSize,
     MaxBufferSize          = (int)Nequeo.Net.Properties.Settings.Default.TransferClientByteMaxReceivedMessageSize,
     ReaderQuotas           = new System.Xml.XmlDictionaryReaderQuotas()
     {
         MaxArrayLength         = (int)Nequeo.Net.Properties.Settings.Default.TransferClientByteMaxReceivedMessageSize,
         MaxBytesPerRead        = (int)Nequeo.Net.Properties.Settings.Default.TransferClientByteMaxReceivedMessageSize,
         MaxDepth               = (int)Nequeo.Net.Properties.Settings.Default.TransferClientByteMaxReceivedMessageSize,
         MaxNameTableCharCount  = (int)Nequeo.Net.Properties.Settings.Default.TransferClientByteMaxReceivedMessageSize,
         MaxStringContentLength = (int)Nequeo.Net.Properties.Settings.Default.TransferClientByteMaxReceivedMessageSize
     },
     Security = new System.ServiceModel.NetTcpSecurity()
     {
         Mode      = System.ServiceModel.SecurityMode.Transport,
         Transport = new System.ServiceModel.TcpTransportSecurity()
         {
             ClientCredentialType = tcpClientCredentialType
         }
     }
 }, username, password, usernameWindows, passwordWindows, clientCertificate, validationMode, x509CertificateValidator
         )
 {
     // Attach to the async execute complete
     // event handler.
     base.AsyncExecuteComplete += new Nequeo.Threading.EventHandler <object, bool, System.Exception>(TransferClient_AsyncExecuteComplete);
 }