public RtmpServerConnection(RtmpServer rtmpServer, Socket socket) : base(null, null) { this._streams = new Dictionary <int, IClientStream>(); this._streamBuffers = new Dictionary <int, int>(); this._pendingVideos = new Dictionary <int, AtomicInteger>(); this._endpoint = rtmpServer.Endpoint; this._readBuffer = ByteBuffer.Allocate(0x1000); this._readBuffer.Flip(); this._rtmpServer = rtmpServer; this._rtmpNetworkStream = new RtmpNetworkStream(socket); this._state = 1; this.SetIsTunneled(false); this.IsTunnelingDetected = false; }
// <summary> // Name of job that is waiting for a valid handshake. // </summary> //private string _waitForHandshakeJob; public RtmpServerConnection(RtmpServer rtmpServer, RtmpNetworkStream stream) : base(rtmpServer.RtmpHandler, RtmpMode.Server, null, null) { _lock = new FastReaderWriterLock(); _endpoint = rtmpServer.Endpoint; _readBuffer = ByteBuffer.Allocate(4096); _readBuffer.Flip(); // We start with an anonymous connection without a scope. // These parameters will be set during the call of "connect" later. _rtmpServer = rtmpServer; _rtmpNetworkStream = stream; //_state = RtmpConnectionState.Active; SetIsTunneled(false); IsTunnelingDetected = false; _readBytes = new AtomicLong(); _writtenBytes = new AtomicLong(); //Set the legacy collection flag from the endpoint channel settings this.Context.UseLegacyCollection = (_endpoint as RtmpEndpoint).IsLegacyCollection; this.Context.UseLegacyThrowable = (_endpoint as RtmpEndpoint).IsLegacyThrowable; }
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); }
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); }