コード例 #1
0
        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);
            }
        }
コード例 #2
0
 /// <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);
     }
 }