|
|
|
@ -2808,17 +2808,19 @@ namespace WebSocketSharp
|
|
|
|
/// </param>
|
|
|
|
/// </param>
|
|
|
|
public void SendAsync (FileInfo file, Action<bool> completed)
|
|
|
|
public void SendAsync (FileInfo file, Action<bool> completed)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var msg = _readyState.CheckIfAvailable (false, true, false, false) ??
|
|
|
|
if (_readyState != WebSocketState.Open) {
|
|
|
|
CheckSendParameter (file);
|
|
|
|
var msg = "The current state of the connection is not Open.";
|
|
|
|
|
|
|
|
throw new InvalidOperationException (msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (msg != null) {
|
|
|
|
if (file == null)
|
|
|
|
_logger.Error (msg);
|
|
|
|
throw new ArgumentNullException ("file");
|
|
|
|
error ("An error has occurred in sending data.", null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
FileStream stream;
|
|
|
|
}
|
|
|
|
if (!file.TryOpenRead (out stream))
|
|
|
|
|
|
|
|
throw new ArgumentException ("Cannot be opened to read.", "file");
|
|
|
|
|
|
|
|
|
|
|
|
sendAsync (Opcode.Binary, file.OpenRead (), completed);
|
|
|
|
sendAsync (Opcode.Binary, stream, completed);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
|