SourceStream.Write C# (CSharp) Method

Write() public method

public Write ( byte b, int a, int c ) : void
b byte
a int
c int
return void
	public override void Write (byte [] b, int a, int c)
	{
		throw new Exception ();
	}
	

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        ///     Write the JSON message to the output stream.
        /// </summary>
        /// <param name="message">
        ///     The message to write.
        /// </param>
        private void WriteJsonMessage(string message)
        {
            // Build the header message.
            var header     = string.Format("Content-Length: {0}{1}{2}{1}{2}", message.Length, (char)0x0D, (char)0x0A);
            var headerData = Encoding.UTF8.GetBytes(header);

            SourceStream.Write(headerData, 0, headerData.Length);

            // Write the body data.
            var bodyData = Encoding.UTF8.GetBytes(message);

            SourceStream.Write(bodyData, 0, bodyData.Length);

            SourceStream.Flush();

            // debug the new message.
            if (DebugStream != null)
            {
                lock (DebugStream)
                {
                    DebugStream.WriteLine("*****************************************");
                    DebugStream.WriteLine(" Direction: {0}", Direction);
                    DebugStream.WriteLine(" Timestamp: {0}", DateTime.Now);
                    DebugStream.WriteLine("*****************************************");
                    DebugStream.WriteLine(message);
                    DebugStream.WriteLine("*****************************************");
                    DebugStream.Flush();
                }
            }
        }
All Usage Examples Of SourceStream::Write