Beispiel #1
0
        /// <summary>
        /// Sends the specified data.
        /// </summary>
        /// <param name="aString">The data.</param>
        /// <param name="raw">whether or not to send raw data</param>
        /// <param name="close">if set to <c>true</c> [close].</param>
        public void Send(String aString, bool raw = false, bool close = false)
        {
            DataFrame dataFrame = DataFrame.CreateInstance();

            dataFrame.Append(aString);
            Context.Handler.Send(dataFrame, Context, raw, close);
        }
        /// <summary>
        /// Sends the specified data buffer.
        /// </summary>
        /// <param name="buffer">The data.</param>
        /// <param name="byteCount">Count of bytes from beginning of buffer. -1 = all bytes.</param>
        /// <param name="raw">if set to <c>true</c> do not add header and do not mask the buffer before sending.</param>
        /// <param name="close">if set to <c>true</c> close the socket after sending.</param>
        public void Send(byte[] buffer, int byteCount = -1, bool raw = false, bool close = false)
        {
            DataFrame dataFrame = DataFrame.CreateInstance();

            dataFrame.IsBinary = true;
            dataFrame.Append(buffer, byteCount);
            Context.Handler.Send(dataFrame, Context, raw, close);
        }