Ejemplo n.º 1
0
        protected override void SendCallback(IAsyncResult result)
        {
            var message = (MessageWrapper)result.AsyncState;

            try
            {
                _sslStream.EndWrite(result);
                _mreWriting.Set();
            }
            catch (Exception ex)
            {
                RaiseErrorThrown(ex);
            }
            finally
            {
                if (!message.Partial)
                {
                    RaiseMessageSubmitted(CloseClient);
                }
                if (!message.Partial && CloseClient)
                {
                    Close();
                }

                SentMre.Set();
            }
        }
Ejemplo n.º 2
0
        //Send message and invokes MessageSubmitted.
        protected override void SendCallback(IAsyncResult result)
        {
            var message = (MessageWrapper)result.AsyncState;

            try
            {
                Listener.EndSend(result);
            }
            catch (SocketException se)
            {
                RaiseErrorThrown(se);
            }
            catch (ObjectDisposedException se)
            {
                RaiseErrorThrown(se);
            }
            finally
            {
                if (!message.Partial)
                {
                    RaiseMessageSubmitted(CloseClient);
                }

                if (!message.Partial && CloseClient && BlockingMessageQueue.Count == 0)
                {
                    Close();
                }

                SentMre.Set();
            }
        }
Ejemplo n.º 3
0
        //Send message and invokes MessageSubmitted.
        protected override void SendCallback(IAsyncResult result)
        {
            try
            {
                var receiver = (SslStream)result.AsyncState;
                receiver.EndWrite(result);
                _mreWriting.Set();
            }
            catch (SocketException se)
            {
                throw new SocketException(se.ErrorCode);
            }
            catch (ObjectDisposedException ode)
            {
                throw new ObjectDisposedException(ode.ObjectName, ode.Message);
            }
            finally
            {
                InvokeMessageSubmitted(CloseClient);

                if (CloseClient)
                {
                    Close();
                }

                SentMre.Set();
            }
        }
Ejemplo n.º 4
0
        protected override void SendCallback(IAsyncResult result)
        {
            var message = (MessageWrapper)result.AsyncState;

            try
            {
                _sslStream.EndWrite(result);
                _mreWriting.Set();
            }
            catch (SocketException se)
            {
                throw new SocketException(se.ErrorCode);
            }
            catch (ObjectDisposedException ode)
            {
                throw new ObjectDisposedException(ode.ObjectName, ode.Message);
            }
            finally
            {
                if (!message.Partial)
                {
                    RaiseMessageSubmitted(CloseClient);
                }
                if (!message.Partial && CloseClient)
                {
                    Close();
                }

                SentMre.Set();
            }
        }
        //Send message and invokes MessageSubmitted.
        protected override void SendCallback(IAsyncResult result)
        {
            try
            {
                var receiver = (Socket)result.AsyncState;
                receiver.EndSend(result);
            }
            catch (SocketException se)
            {
                throw new Exception(se.ToString());
            }
            catch (ObjectDisposedException se)
            {
                throw new Exception(se.ToString());
            }
            finally
            {
                InvokeMessageSubmitted(CloseClient);

                if (CloseClient)
                {
                    Close();
                }

                SentMre.Set();
            }
        }