Ejemplo n.º 1
0
        private void CloseConnectionCallback(IAsyncResult ar)
        {
            int sent = 0;

            try
            {
                sent = sender.EndSend(ar);
            } catch (Exception e)
            {
                WriteLog(LogStrings.ExceptionWasThrown(e));
                return;
            }

            WriteLog(LogStrings.BytesWereSuccessfulySent(sent));
            WriteLog(LogStrings.CloseSocket());

            try
            {
                sender.Shutdown(SocketShutdown.Both);
                sender.Close();
            } catch (Exception e)
            {
                WriteLog(LogStrings.ExceptionWasThrown(e));
            }

            senderSema.Release();
        }