internal void FlushNamedStream(TcpJsonNamedStream tcpJsonNamedStream) { var buffer = tcpJsonNamedStream.GetWriteCacheAndClear(); if (buffer.Length > 0) { var package = new TcpJsonPackage { Type = TcpJsonPackageType.NamedStream, DataType = tcpJsonNamedStream.Name, DataBytes = buffer }; SendPackage(package); } }
/// <summary> /// Gets a named Stream object /// </summary> /// <param name="name">Stream name</param> /// <returns>Named stream</returns> public TcpJsonNamedStream GetNamedStream(string name) { lock (mNamedStreams) { var found = mNamedStreams.FirstOrDefault(s => s.Name == name); if (found != null) { return(found); } mNamedStreams.Add(found = new TcpJsonNamedStream(this) { Name = name }); return(found); } }