public RtmpClientConnection(IRtmpHandler handler, Socket socket, bool secure, string host)
            : base(handler, RtmpMode.Client, null, null)
		{
			_secure = secure;
			_host = host;
#if FXCLIENT
            //TODO
            socket.ReceiveBufferSize = 4096;
            socket.SendBufferSize = 4096;
#else
            socket.ReceiveBufferSize = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.ReceiveBufferSize;
            socket.SendBufferSize = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.SendBufferSize;
#endif
            _handler = handler;
            _readBuffer = ByteBuffer.Allocate(4096);
            _readBuffer.Flip();

			// Wrap a secure connection in an SslStream.
			if (_secure)
			{
				//new SslStream(tcpstream, false, new RemoteCertificateValidationCallback(TrustAllCertificatesCallback));
				SslStream stream = new SslStream(new NetworkStream(socket), false, new RemoteCertificateValidationCallback(TrustAllCertificates));
				stream.AuthenticateAsClient(host);
				_rtmpNetworkStream = new RtmpNetworkStream(socket, stream);
			}
			else
				_rtmpNetworkStream = new RtmpNetworkStream(socket);

            Context.SetMode(RtmpMode.Client);
		}
        public RtmpClientConnection(IRtmpHandler handler, Socket socket, bool useSsl, string sslHostname)
            : base(handler, RtmpMode.Client, null, null)
        {
#if FXCLIENT
            //TODO
            socket.ReceiveBufferSize = 4096;
            socket.SendBufferSize    = 4096;
#else
            socket.ReceiveBufferSize = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.ReceiveBufferSize;
            socket.SendBufferSize    = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.SendBufferSize;
#endif
            _usingSsl    = useSsl;
            _sslHostname = sslHostname;
            _handler     = handler;
            _readBuffer  = ByteBuffer.Allocate(4096);
            _readBuffer.Flip();
            if (_usingSsl)
            {
                // Trust all certificates
                var stream = new SslStream(new NetworkStream(socket), false, new RemoteCertificateValidationCallback((sender, certificate, chain, errors) => true));
                // TODO: This is blocking. Make it not so.
                stream.AuthenticateAsClient(_sslHostname);
                _rtmpNetworkStream = new RtmpNetworkStream(socket, stream);
            }
            else
            {
                _rtmpNetworkStream = new RtmpNetworkStream(socket);
            }
            Context.SetMode(RtmpMode.Client);
        }
Beispiel #3
0
        public RtmpClientConnection(IRtmpHandler handler, Socket socket, bool secure, string host)
            : base(handler, RtmpMode.Client, null, null)
        {
            _secure = secure;
            _host   = host;
#if FXCLIENT
            //TODO
            socket.ReceiveBufferSize = 4096;
            socket.SendBufferSize    = 4096;
#else
            socket.ReceiveBufferSize = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.ReceiveBufferSize;
            socket.SendBufferSize    = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.SendBufferSize;
#endif
            _handler    = handler;
            _readBuffer = ByteBuffer.Allocate(4096);
            _readBuffer.Flip();

            // Wrap a secure connection in an SslStream.
            if (_secure)
            {
                //new SslStream(tcpstream, false, new RemoteCertificateValidationCallback(TrustAllCertificatesCallback));
                SslStream stream = new SslStream(new NetworkStream(socket), false, new RemoteCertificateValidationCallback(TrustAllCertificates));
                stream.AuthenticateAsClient(host);
                _rtmpNetworkStream = new RtmpNetworkStream(socket, stream);
            }
            else
            {
                _rtmpNetworkStream = new RtmpNetworkStream(socket);
            }

            Context.SetMode(RtmpMode.Client);
        }
 public RtmpClientConnection(IRtmpHandler handler, Socket socket) : base(null, null)
 {
     socket.ReceiveBufferSize = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.ReceiveBufferSize;
     socket.SendBufferSize    = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.SendBufferSize;
     this._handler            = handler;
     this._readBuffer         = ByteBuffer.Allocate(0x1000);
     this._readBuffer.Flip();
     this._rtmpNetworkStream = new RtmpNetworkStream(socket);
     this._state             = 1;
     base.Context.SetMode(RtmpMode.Client);
 }
		public RtmpClientConnection(IRtmpHandler handler, Socket socket)
			: base(handler, RtmpMode.Client, null, null) {
#if FXCLIENT
            //TODO
            socket.ReceiveBufferSize = 4096;
            socket.SendBufferSize = 4096;
#else
			socket.ReceiveBufferSize = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.ReceiveBufferSize;
			socket.SendBufferSize = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.SendBufferSize;
#endif
			_handler = handler;
			_readBuffer = ByteBuffer.Allocate(4096);
			_readBuffer.Flip();
			_rtmpNetworkStream = new RtmpNetworkStream(socket);
			Context.SetMode(RtmpMode.Client);
		}
Beispiel #6
0
        public RtmpClientConnection(IRtmpHandler handler, Socket socket)
            : base(handler, RtmpMode.Client, null, null)
        {
#if FXCLIENT
            //TODO
            socket.ReceiveBufferSize = 4096;
            socket.SendBufferSize    = 4096;
#else
            socket.ReceiveBufferSize = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.ReceiveBufferSize;
            socket.SendBufferSize    = FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpTransportSettings.SendBufferSize;
#endif
            _handler    = handler;
            _readBuffer = ByteBuffer.Allocate(4096);
            _readBuffer.Flip();
            _rtmpNetworkStream = new RtmpNetworkStream(socket);
            Context.SetMode(RtmpMode.Client);
        }
Beispiel #7
0
		internal RtmpConnection(IRtmpHandler handler, RtmpMode mode, string path, IDictionary parameters)
			: base(path, parameters) {
			_handler = handler;
			_channels = new CopyOnWriteDictionary<int, RtmpChannel>(4);
			_streams = new CopyOnWriteDictionary<int, IClientStream>();
			_pendingVideos = new CopyOnWriteDictionary<int, AtomicInteger>();
			_streamCount = new AtomicInteger();
			_streamBuffers = new CopyOnWriteDictionary<int, int>();
			_reservedStreams = new BitArray(0);
			_pendingCalls = new CopyOnWriteDictionary<int, IServiceCall>();
			// We start with an anonymous connection without a scope.
			// These parameters will be set during the call of "connect" later.
			_context = new RtmpContext(mode);
			//Transaction id depends on server/client mode
			//When server mode is set we cannot push messages with transaction id = 1 (connect)
			_invokeId = mode == RtmpMode.Server ? new AtomicInteger(1) : new AtomicInteger(0);
		}
		public RtmpClientConnection(IRtmpHandler handler, Socket socket)
			: this(handler, socket, false, null)
		{
		}
Beispiel #9
0
 public RtmpClientConnection(IRtmpHandler handler, Socket socket)
     : this(handler, socket, false, null)
 {
 }