예제 #1
0
 private void HandleDataWritten(IAsyncResult ar)
 {
     try
     {
         _stream.EndWrite(ar);
         _keepAliveTracker.OnDataSent();
     }
     catch (Exception ex)
     {
         try
         {
             HandleSendOperationException(ex);
         }
         catch (Exception innnerException)
         {
             _log(innnerException.Message);
         }
     }
 }
예제 #2
0
 private void HandleDataWritten(IAsyncResult ar)
 {
     try
     {
         _stream.EndWrite(ar);
         _keepAliveTracker.OnDataSent();
     }
     catch (Exception ex)
     {
         if (!CloseIfShould(ex))
         {
             throw;
         }
     }
 }
예제 #3
0
        private async Task SendFrame(byte[] frame)
        {
            if (frame == null)
            {
                throw new ArgumentNullException("frame");
            }
            if (State != WebSocketState.Open)
            {
                throw new InvalidOperationException("This websocket session has not connected.");
            }

            try
            {
                await _stream.WriteAsync(frame, 0, frame.Length);

                _keepAliveTracker.OnDataSent();
            }
            catch (Exception ex) when(!ShouldThrow(ex))
            {
            }
        }