Esempio n. 1
0
        private void CloseConnection()
        {
            if (sender == null)
            {
                return;
            }

            senderSema.Wait();

            WriteLog(LogStrings.CloseConnection());
            WriteLog(LogStrings.AttemptingToSendMessage(endMessage));

            byte[] bytes = Encoding.UTF8.GetBytes(endMessage);

            sender.BeginSend(bytes, 0, bytes.Length, 0, new AsyncCallback(CloseConnectionCallback), sender);
        }