diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs
index 866d3a76..38cea802 100644
--- a/websocket-sharp/WebSocket.cs
+++ b/websocket-sharp/WebSocket.cs
@@ -2767,6 +2767,74 @@ namespace WebSocketSharp
send (Opcode.Text, new MemoryStream (bytes));
}
+ ///
+ /// Sends the specified of data from
+ /// the specified using the WebSocket
+ /// connection.
+ ///
+ ///
+ /// A from which reads the binary data to send.
+ ///
+ ///
+ /// An that specifies the number of bytes to read and send.
+ ///
+ ///
+ /// The current state of the connection is not Open.
+ ///
+ ///
+ /// is .
+ ///
+ ///
+ ///
+ /// cannot be read.
+ ///
+ ///
+ /// -or-
+ ///
+ ///
+ /// is less than 1.
+ ///
+ ///
+ /// -or-
+ ///
+ ///
+ /// No data could be read from .
+ ///
+ ///
+ public void Send (Stream stream, int length)
+ {
+ if (_readyState != WebSocketState.Open) {
+ var msg = "The current state of the connection is not Open.";
+ throw new InvalidOperationException (msg);
+ }
+
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+
+ if (!stream.CanRead)
+ throw new ArgumentException ("It cannot be read.", "stream");
+
+ if (length < 1)
+ throw new ArgumentException ("It is less than 1.", "length");
+
+ var bytes = stream.ReadBytes (length);
+
+ var len = bytes.Length;
+ if (len == 0)
+ throw new ArgumentException ("No data could be read from it.", "stream");
+
+ if (len < length) {
+ _logger.Warn (
+ String.Format (
+ "Only {0} byte(s) of data could be read from the specified stream.",
+ len
+ )
+ );
+ }
+
+ send (Opcode.Binary, new MemoryStream (bytes));
+ }
+
///
/// Sends the specified asynchronously using
/// the WebSocket connection.