Write() public method

public Write ( Channel channel, Stream writer ) : bool
channel Channel
writer Stream
return bool
Example #1
0
        //public override bool AllowNearProtocol(ulong type)
        //{
        //    Logger.FATAL("This protocol doesn't allow any near protocols");
        //    return false;
        //}

        //public override bool AllowFarProtocol(ulong type)
        //{
        //    return type == ProtocolTypes.PT_TCP || type == ProtocolTypes.PT_RTMPE || type == ProtocolTypes.PT_INBOUND_SSL ||
        //           type == ProtocolTypes.PT_INBOUND_HTTP_FOR_RTMP;
        //}
        public void ChunkAmfMessage(Header header, BufferWithOffset input, MemoryStream output)
        {
            var  channel = GetChannel(header.ChannelId);
            long available;

            while ((available = input.Length) != 0)
            {
                header.Write(channel, output);
                if (available > _outboundChunkSize)
                {
                    available = _outboundChunkSize;
                }
                output.Write(input.Buffer, input.Offset, (int)available);
                channel.lastOutProcBytes += (uint)available;
                input.Offset             += (int)available;
            }
            channel.lastOutProcBytes = 0;
        }
        //public override bool AllowNearProtocol(ulong type)
        //{
        //    Logger.FATAL("This protocol doesn't allow any near protocols");
        //    return false;
        //}

        //public override bool AllowFarProtocol(ulong type)
        //{
        //    return type == ProtocolTypes.PT_TCP || type == ProtocolTypes.PT_RTMPE || type == ProtocolTypes.PT_INBOUND_SSL ||
        //           type == ProtocolTypes.PT_INBOUND_HTTP_FOR_RTMP;
        //}
        public void ChunkAmfMessage( Header header,BufferWithOffset input, MemoryStream output)
        {
            var channel = GetChannel(header.ChannelId);
            long available;
            while ((available = input.Length) != 0)
            {
                header.Write(channel, output);
                if (available > _outboundChunkSize)
                {
                    available = _outboundChunkSize;
                }
                output.Write(input.Buffer, input.Offset, (int)available);
                channel.lastOutProcBytes += (uint)available;
                input.Offset += (int)available;
            }
            channel.lastOutProcBytes = 0;
        }