Exemplo n.º 1
0
 /// <summary>
 /// Initializes the reactive client using a custom stream transform.
 /// This transform allows using SslStream to provide a secure communication channel to a server
 /// that requires SSL.
 /// </summary>
 /// <param name="hostname">The host name or IP address of the TCP server to connect to.</param>
 /// <param name="port">The port to connect to.</param>
 /// <param name="streamTransform">The callback function to use to obtain the communication <see cref="Stream"/>.
 /// The callback is passed the original Stream from the underlying <see cref="TcpClient"/>.</param>
 /// <example>
 /// Using with SSL:
 /// <code>
 /// var client  = new ReactiveClient(host, port, stream => {
 ///   var ssl = new SslStream(
 ///     stream,
 ///     userCertificateValidationCallback: (sender, certificate, chain, errors) => true  // ignore SSL cert validation
 ///   );
 ///   ssl.AuthenticateAsClient(host);
 ///   return ssl;
 /// }
 /// </code>
 /// </example>
 public ReactiveClient(string hostname, int port, Func <Stream, Stream> streamTransform)
 {
     this.hostname        = hostname;
     this.port            = port;
     this.streamTransform = streamTransform;
     tracer.ReactiveClientCreated(hostname, port);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes the reactive client using a custom stream transform.
 /// This transform allows using SslStream to provide a secure communication channel to a server
 /// that requires SSL.
 /// </summary>
 /// <param name="hostname">The host name or IP address of the TCP server to connect to.</param>
 /// <param name="port">The port to connect to.</param>
 /// <param name="streamTransform">The callback function to use to obtain the communication <see cref="Stream"/>.
 /// The callback is passed the original Stream from the underlying <see cref="TcpClient"/>.</param>
 /// <param name="maximumBufferSize">An optional value for the maximum number of bytes
 /// that is stored before TCP flow control kicks in.
 /// The default value is <see cref="ReactiveSocket.MaximumBufferSize"/>
 /// </param>
 /// <example>
 /// Using with SSL:
 /// <code>
 /// var client  = new ReactiveClient(host, port, stream => {
 ///   var ssl = new SslStream(
 ///     stream,
 ///     userCertificateValidationCallback: (sender, certificate, chain, errors) => true  // ignore SSL cert validation
 ///   );
 ///   ssl.AuthenticateAsClient(host);
 ///   return ssl;
 /// }
 /// </code>
 /// </example>
 public ReactiveClient(string hostname, int port, Func <Stream, Stream> streamTransform, int maximumBufferSize = MaximumBufferSize)
     : base(maximumBufferSize)
 {
     this.hostname        = hostname;
     this.port            = port;
     this.streamTransform = streamTransform;
     tracer.ReactiveClientCreated(hostname, port);
 }