コード例 #1
0
ファイル: SslSocket.cs プロジェクト: mdX7/WoWLegionCompanion
 private void WriteCallback(IAsyncResult ar)
 {
     SslSocket.BeginSendDelegate beginSendDelegate = (SslSocket.BeginSendDelegate)ar.AsyncState;
     if (this.Socket == null || this.m_sslStream == null)
     {
         if (beginSendDelegate != null)
         {
             beginSendDelegate(false);
         }
         return;
     }
     try
     {
         this.m_sslStream.EndWrite(ar);
         this.m_canSend = true;
         if (beginSendDelegate != null)
         {
             beginSendDelegate(true);
         }
     }
     catch (Exception ex)
     {
         SslSocket.s_log.LogWarning("Exception while trying to call EndWrite. {0}", new object[]
         {
             ex
         });
         if (beginSendDelegate != null)
         {
             beginSendDelegate(false);
         }
     }
 }
コード例 #2
0
 public void BeginSend(byte[] bytes, SslSocket.BeginSendDelegate sendDelegate)
 {
     try
     {
         if (this.m_sslStream == null)
         {
             throw new NullReferenceException("m_sslStream is null!");
         }
         this.m_canSend = false;
         this.m_sslStream.BeginWrite(bytes, 0, (int)bytes.Length, new AsyncCallback(this.WriteCallback), sendDelegate);
     }
     catch (Exception exception)
     {
         SslSocket.s_log.LogWarning("Exception while trying to call BeginWrite. {0}", new object[] { exception });
         if (sendDelegate != null)
         {
             sendDelegate(false);
         }
     }
 }